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

def agent_leave(consul_url=None, token=None, node=None):
    '''
    Used to instruct the agent to force a node into the left state.

    :param consul_url: The Consul server URL.
    :param node: The node the agent will force into left state
    :return: Boolean and message indicating success or failure.

    CLI Example:

    .. code-block:: bash

        salt '*' consul.agent_leave node='web1.example.com'

    '''
    ret = {}
    query_params = {}
    if not consul_url:
        consul_url = _get_config()
        if not consul_url:
            log.error('No Consul URL found.')
            ret['message'] = 'No Consul URL found.'
            ret['res'] = False
            return ret

    if not node:
        raise SaltInvocationError('Required argument "node" is missing.')

    function = 'agent/force-leave/{0}'.format(node)
    res = _query(consul_url=consul_url,
                 function=function,
                 token=token,
                 method='GET',
                 query_params=query_params)
    if res['res']:
        ret['res'] = True
        ret['message'] = 'Node {0} put in leave state.'.format(node)
    else:
        ret['res'] = False
        ret['message'] = 'Unable to change state for {0}.'.format(node)
    return ret