<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def _query(method='GET', profile=None, url=None, path='api/v1',
           action=None, api_key=None, service=None, params=None,
           data=None, subdomain=None, verify_ssl=True):
    '''
    Query the PagerDuty API.

    This method should be in utils.pagerduty.

    '''

    if profile:
        creds = __salt__['config.option'](profile)
    else:
        creds = {
            'pagerduty.api_key': api_key,
            'pagerduty.subdomain': subdomain,
        }

    if url is None:
        url = 'https://{0}.pagerduty.com/{1}/{2}'.format(
            creds['pagerduty.subdomain'],
            path,
            action
        )

    if params is None:
        params = {}

    if data is None:
        data = {}

    headers = {
        'Authorization': 'Token token={0}'.format(creds['pagerduty.api_key'])
    }

    if method != 'GET':
        headers['Content-type'] = 'application/json'

    result = requests.request(
        method,
        url,
        headers=headers,
        params=params,
        data=salt.utils.json.dumps(data),
        verify=verify_ssl
    )

    if result.text is None or result.text == '':
        return None
    result_json = result.json()
    # if this query supports pagination, loop and fetch all results, merge them together
    if 'total' in result_json and 'offset' in result_json and 'limit' in result_json:
        offset = result_json['offset']
        limit = result_json['limit']
        total = result_json['total']
        while offset + limit < total:
            offset = offset + limit
            limit = 100
            data['offset'] = offset
            data['limit'] = limit
            next_page_results = requests.request(method,
                                                 url,
                                                 headers=headers,
                                                 params=params,
                                                 data=data,  # Already serialized above, don't do it again
                                                 verify=verify_ssl).json()
            offset = next_page_results['offset']
            limit = next_page_results['limit']
            # merge results
            for k, v in result_json.items():
                if isinstance(v, list):
                    result_json[k] += next_page_results[k]
    return result_json