'Return state or entity_id if given.'

def _resolve_state(self, entity_id_or_state):

    if isinstance(entity_id_or_state, State):
        return entity_id_or_state
    elif isinstance(entity_id_or_state, str):
        return self._hass.states.get(entity_id_or_state)
    return None
