Gets a key to choose a choice from any value.

def get_choice(value):
    """Gets a key to choose a choice from any value."""
    if value is None:
        return 'null'
    for attr in ['__name__', 'name']:
        if hasattr(value, attr):
            return getattr(value, attr)
    return str(value)