def alarm_keypress_handler(service):
 entity_ids = service.data.get(ATTR_ENTITY_ID)
 keypress = service.data.get(ATTR_KEYPRESS)
 _target_devices = [device for device in DEVICES if (device.entity_id in entity_ids)]
 for device in _target_devices:
  EnvisalinkAlarm.alarm_keypress(device, keypress)

def alarm_keypress_handler ( service ) : entity_ids = service . data . get ( ATTR_ENTITY_ID ) keypress = service . data . get ( ATTR_KEYPRESS ) _target_devices = [ device for device in DEVICES if ( device . entity_id in entity_ids ) ] for device in _target_devices : EnvisalinkAlarm . alarm_keypress ( device , keypress )
map services to methods on alarm .