def present(profile='pagerduty', subdomain=None, api_key=None, **kwargs):
    '''
    Ensure that a pagerduty escalation policy exists.  Will create or update as needed.

    This method accepts as args everything defined in
    https://developer.pagerduty.com/documentation/rest/escalation_policies/create.
    In addition, user and schedule id's will be translated from name (or email address)
    into PagerDuty unique ids.  For example:

    .. code-block:: yaml

    pagerduty_escalation_policy.present:
        - name: bruce test escalation policy
        - escalation_rules:
            - targets:
                - type: schedule
                  id: 'bruce test schedule level1'
                - type: user
                  id: 'Bruce Sherrod'

    In this example, 'Bruce Sherrod' will be looked up and replaced with the
    PagerDuty id (usually a 7 digit all-caps string, e.g. PX6GQL7)

    '''
    # for convenience, we accept id, name, or email for users
    # and we accept the id or name for schedules
    for escalation_rule in kwargs['escalation_rules']:
        for target in escalation_rule['targets']:
            target_id = None
            if target['type'] == 'user':
                user = __salt__['pagerduty_util.get_resource']('users',
                                                               target['id'],
                                                               ['email', 'name', 'id'],
                                                               profile=profile,
                                                               subdomain=subdomain,
                                                               api_key=api_key)
                if user:
                    target_id = user['id']
            elif target['type'] == 'schedule':
                schedule = __salt__['pagerduty_util.get_resource']('schedules',
                                                                   target['id'],
                                                                   ['name', 'id'],
                                                                   profile=profile,
                                                                   subdomain=subdomain,
                                                                   api_key=api_key)
                if schedule:
                    target_id = schedule['schedule']['id']
            if target_id is None:
                raise Exception('unidentified target: {0}'.format(target))
            target['id'] = target_id

    r = __salt__['pagerduty_util.resource_present']('escalation_policies',
                                                    ['name', 'id'],
                                                    _diff,
                                                    profile,
                                                    subdomain,
                                                    api_key,
                                                    **kwargs)
    return r
Ensure that a pagerduty escalation policy exists.  Will create or update as needed.

    This method accepts as args everything defined in
    https://developer.pagerduty.com/documentation/rest/escalation_policies/create.
    In addition, user and schedule id's will be translated from name (or email address)
    into PagerDuty unique ids.  For example:

    .. code-block:: yaml

    pagerduty_escalation_policy.present:
        - name: bruce test escalation policy
        - escalation_rules:
            - targets:
                - type: schedule
                  id: 'bruce test schedule level1'
                - type: user
                  id: 'Bruce Sherrod'

    In this example, 'Bruce Sherrod' will be looked up and replaced with the
    PagerDuty id (usually a 7 digit all-caps string, e.g. PX6GQL7)