def next_setting_utc(hass, entity_id=None):
 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, KeyError):
  return None

def next_setting_utc ( hass , entity_id = None ) : 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 , KeyError ) : return None
utc datetime object of the next sun setting .