def next_setting_utc(hass, entity_id=None):
    """UTC datetime object of the next sun setting."""
    entity_id = entity_id or ENTITY_ID

    state = hass.states.get(ENTITY_ID)

    try:
        return dt_util.parse_datetime(
            state.attributes[STATE_ATTR_NEXT_SETTING])
    except (AttributeError, __HOLE__):
        # AttributeError if state is None
        # KeyError if STATE_ATTR_NEXT_SETTING does not exist
        return None
dataset/ETHPy150Open home-assistant/home-assistant/homeassistant/components/sun.py/next_setting_utc