def _diff(state_data, resource_object):
 objects_differ = None
 for (k, v) in state_data['service'].items():
  if (k == 'escalation_policy_id'):
   resource_value = resource_object['escalation_policy']['id']
  elif (k == 'service_key'):
   resource_value = resource_object['service_key']
   if ('@' in resource_value):
    resource_value = resource_value[0:resource_value.find('@')]
  else:
   resource_value = resource_object[k]
  if (v != resource_value):
   objects_differ = '{0} {1} {2}'.format(k, v, resource_value)
   break
 if objects_differ:
  return state_data
 else:
  return {}

def _diff ( state_data , resource_object ) : objects_differ = None for ( k , v ) in state_data [ 'service' ] . items ( ) : if ( k == 'escalation_policy_id' ) : resource_value = resource_object [ 'escalation_policy' ] [ 'id' ] elif ( k == 'service_key' ) : resource_value = resource_object [ 'service_key' ] if ( '@' in resource_value ) : resource_value = resource_value [ 0 : resource_value . find ( '@' ) ] else : resource_value = resource_object [ k ] if ( v != resource_value ) : objects_differ = '{0} {1} {2}' . format ( k , v , resource_value ) break if objects_differ : return state_data else : return { }
diff of strings; returns a generator .