def agent_service_deregister(consul_url=None, token=None, serviceid=None):
    '''
    Used to remove a service.

    :param consul_url: The Consul server URL.
    :param serviceid: A serviceid describing the service.
    :return: Boolean and message indicating success or failure.

    CLI Example:

    .. code-block:: bash

        salt '*' consul.agent_service_deregister serviceid='redis'

    '''
    ret = {}
    data = {}
    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 serviceid:
        raise SaltInvocationError('Required argument "serviceid" is missing.')

    function = 'agent/service/deregister/{0}'.format(serviceid)
    res = _query(consul_url=consul_url,
                 function=function,
                 token=token,
                 method='PUT',
                 data=data)
    if res['res']:
        ret['res'] = True
        ret['message'] = 'Service {0} removed from agent.'.format(serviceid)
    else:
        ret['res'] = False
        ret['message'] = 'Unable to remove service {0}.'.format(serviceid)
    return ret