def is_locked(hass, entity_id=None):
    'Return if the lock is locked based on the statemachine.'
    entity_id = (entity_id or ENTITY_ID_ALL_LOCKS)
    return hass.states.is_state(entity_id, STATE_LOCKED)
Return if the lock is locked based on the statemachine.
def is_locked(hass, entity_id=None):
    
    entity_id = (entity_id or ENTITY_ID_ALL_LOCKS)
    return hass.states.is_state(entity_id, STATE_LOCKED)