def _diff(state_data, resource_object):
    '''helper method to compare salt state info with the PagerDuty API json structure,
    and determine if we need to update.

    returns the dict to pass to the PD API to perform the update, or empty dict if no update.
    '''
    objects_differ = None

    for k, v in state_data.items():
        if k == 'escalation_rules':
            v = _escalation_rules_to_string(v)
            resource_value = _escalation_rules_to_string(resource_object[k])
        else:
            if k not in resource_object.keys():
                objects_differ = True
            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 . items ( ) : if k == 'escalation_rules' : v = _escalation_rules_to_string ( v ) resource_value = _escalation_rules_to_string ( resource_object [ k ] ) else : if k not in resource_object . keys ( ) : objects_differ = True 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 { }
helper method to compare salt state info with the PagerDuty API json structure,
    and determine if we need to update.

    returns the dict to pass to the PD API to perform the update, or empty dict if no update.