<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(key, value=None, service=None, profile=None):  # pylint: disable=W0613
    '''
    Get a value from the REST interface
    '''
    comps = key.split('?')
    key = comps[0]
    key_vars = {}
    for pair in comps[1].split('&'):
        pair_key, pair_val = pair.split('=')
        key_vars[pair_key] = pair_val

    renderer = __opts__.get('renderer', 'jinja|yaml')
    rend = salt.loader.render(__opts__, {})
    blacklist = __opts__.get('renderer_blacklist')
    whitelist = __opts__.get('renderer_whitelist')
    url = compile_template(
        ':string:',
        rend,
        renderer,
        blacklist,
        whitelist,
        input_data=profile[key]['url'],
        **key_vars
    )

    extras = {}
    for item in profile[key]:
        if item not in ('backend', 'url'):
            extras[item] = profile[key][item]

    result = http.query(
        url,
        decode=True,
        **extras
    )

    return result['dict']