<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_dict=None, url=None, path='api/v1',
          action=None, api_key=None, service=None, params=None,
          data=None, subdomain=None, client_url=None, description=None,
          opts=None, verify_ssl=True):
    '''
    Query the PagerDuty API
    '''
    user_agent = 'SaltStack {0}'.format(__version__)

    if opts is None:
        opts = {}

    if isinstance(profile_dict, dict):
        creds = profile_dict
    else:
        creds = {}

    if api_key is not None:
        creds['pagerduty.api_key'] = api_key

    if service is not None:
        creds['pagerduty.service'] = service

    if subdomain is not None:
        creds['pagerduty.subdomain'] = subdomain

    if client_url is None:
        client_url = 'https://{0}.pagerduty.com'.format(
            creds['pagerduty.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 = {}

    data['client'] = user_agent

    # pagerduty.service is not documented.  While it makes sense to have in
    # some cases, don't force it when it is not defined.
    if 'pagerduty.service' in creds and creds['pagerduty.service'] is not None:
        data['service_key'] = creds['pagerduty.service']
    data['client_url'] = client_url
    if 'event_type' not in data:
        data['event_type'] = 'trigger'
    if 'description' not in data:
        if not description:
            data['description'] = 'SaltStack Event Triggered'
        else:
            data['description'] = description

    headers = {
        'User-Agent': user_agent,
        'Authorization': 'Token token={0}'.format(creds['pagerduty.api_key'])
    }
    if method == 'GET':
        data = {}
    else:
        headers['Content-type'] = 'application/json'

    result = salt.utils.http.query(
        url,
        method,
        params=params,
        header_dict=headers,
        data=salt.utils.json.dumps(data),
        decode=False,
        text=True,
        opts=opts,
    )

    return result['text']