import typing
import enum


def _enum_labels(
    value: typing.Union[int, str, enum.Enum],
    enum_type: typing.Optional[typing.Type] = None,
) -> typing.Dict[int, str]:
    """ Gets the human friendly labels of a known enum and what value they map to. """
    def get_labels(v):
        return getattr(v, 'native_labels', lambda: {})()

    return get_labels(enum_type) if enum_type else get_labels(value)