def _device_from_servicecall(hass, service):
 address = service.data.get(ATTR_ADDRESS)
 proxy = service.data.get(ATTR_PROXY)
 if proxy:
  return hass.data[DATA_HOMEMATIC].devices[proxy].get(address)
 for (_, devices) in hass.data[DATA_HOMEMATIC].devices.items():
  if (address in devices):
   return devices[address]

def _device_from_servicecall ( hass , service ) : address = service . data . get ( ATTR_ADDRESS ) proxy = service . data . get ( ATTR_PROXY ) if proxy : return hass . data [ DATA_HOMEMATIC ] . devices [ proxy ] . get ( address ) for ( _ , devices ) in hass . data [ DATA_HOMEMATIC ] . devices . items ( ) : if ( address in devices ) : return devices [ address ]
extract homematic device from service call .