'Send a request to the CommandBridge API
@param method: the HTTP method
@param path: the path relative to the repository URL
@param data: the data to send
@param auth: this is an authorization request'

def _send_request(self, method='GET', path=None, args=None, data=None, auth=False):

    xml = current.xml
    repository = self.repository
    url = repository.url.rstrip('/')
    if path:
        url = '/'.join((url, path.lstrip('/')))
    if args:
        url = '?'.join((url, urllib.urlencode(args)))
    req = urllib2.Request(url=url)
    handlers = []
    site_key = repository.site_key
    if (not site_key):
        message = 'CommandBridge    Authorization    failed:    no    access    token    (site    key)'
        current.log.error(message)
        return (None, message)
    req.add_header('Authorization-Token', ('%s' % site_key))
    request_data = (data if (data is not None) else '')
    if request_data:
        req.add_header('Content-Type', 'application/xml')
    req.add_header('Accept', 'application/xml')
    config = repository.config
    proxy = (repository.proxy or config.proxy or None)
    if proxy:
        current.log.debug(('using    proxy=%s' % proxy))
        proxy_handler = urllib2.ProxyHandler({'https': proxy})
        handlers.append(proxy_handler)
    if handlers:
        opener = urllib2.build_opener(*handlers)
        urllib2.install_opener(opener)
    response = None
    message = None
    try:
        if (method == 'POST'):
            f = urllib2.urlopen(req, data=request_data)
        else:
            f = urllib2.urlopen(req)
    except urllib2.HTTPError as e:
        message = ('HTTP    %s:    %s' % (e.code, e.reason))
        error_response = xml.parse(e)
        if error_response:
            error_messages = error_response.findall('Message')
            details = '    /    '.join((item.text for item in error_messages))
            message = ('%s    (%s)' % (message, details))
    else:
        response = xml.parse(f)
        if (response is None):
            if (method == 'POST'):
                response = True
            elif xml.error:
                message = xml.error
    return (response, message)
