from typing import Any


def _yamlize(value: Any) -> Any:
    """Converts a python value to a valid YAML representation.

    Args:
        value: the python value to convert

    Returns:
        Either a string containing ``"null"``, ``"true"`` or ``"false"``
        for the special cases ``None``, ``True`` and ``False``, resp., or
        ``value.name`` if present (for ``Enum``\\ s), or
        the same value received as input for other cases."""

    if value is None:
        return "null"

    if value is True:
        return "true"

    if value is False:
        return "false"

    if hasattr(value, "name"):  # For Enums
        return value.name  # pylint:disable=no-member

    return value