import enum


def _str_or_enum_to_str(value):
    """
    Given a scalar value or an enum, return the scalar value if it's a scalar value, or the enum's
    value field if it's an enum.
    """
    if isinstance(value, enum.Enum):
        return value.value
    else:
        return value