Ensure that a pagerduty schedule exists.
    This method accepts as args everything defined in
    https://developer.pagerduty.com/documentation/rest/schedules/create.
    This means that most arguments are in a dict called "schedule."

    User id's can be pagerduty id, or name, or email address.

def present(profile='pagerduty', subdomain=None, api_key=None, **kwargs):
    '''
    Ensure that a pagerduty schedule exists.
    This method accepts as args everything defined in
    https://developer.pagerduty.com/documentation/rest/schedules/create.
    This means that most arguments are in a dict called "schedule."

    User id's can be pagerduty id, or name, or email address.
    '''
    # for convenience, we accept id, name, or email as the user id.
    kwargs['schedule']['name'] = kwargs['name']  # match PD API structure
    for schedule_layer in kwargs['schedule']['schedule_layers']:
        for user in schedule_layer['users']:
            u = __salt__['pagerduty_util.get_resource']('users',
                                                        user['user']['id'],
                                                        ['email', 'name', 'id'],
                                                        profile=profile,
                                                        subdomain=subdomain,
                                                        api_key=api_key)
            if u is None:
                raise Exception('unknown user: {0}'.format(user))
            user['user']['id'] = u['id']
    r = __salt__['pagerduty_util.resource_present']('schedules',
                                                    ['name', 'id'],
                                                    _diff,
                                                    profile,
                                                    subdomain,
                                                    api_key,
                                                    **kwargs)
    return r