'Sends a request (GET, POST, PUT, DELETE) to the target api.
:param target_uri: target uri (string)
:param method: The method (GET, POST, PUT, or DELETE)
:param params: Additional URL parameters
:param request_object: request payload (dict)
:returns: server response object (dict)
:raises: VolumeBackendAPIException'

def request(self, target_uri, method, params=None, request_object=None):

    (message, status_code) = (None, None)
    if (not self.session):
        self.session = self._establish_rest_session()
    url = ('%(self.base_uri)s%(target_uri)s' % {'self.base_uri': self.base_uri, 'target_uri': target_uri})
    try:
        if request_object:
            response = self.session.request(method=method, url=url, data=json.dumps(request_object, sort_keys=True, indent=4))
        elif params:
            response = self.session.request(method=method, url=url, params=params)
        else:
            response = self.session.request(method=method, url=url)
        status_code = response.status_code
        try:
            message = response.json()
        except ValueError:
            LOG.debug('No    response    received    from    API.    Status    code    received    is:    %(status_code)s', {'status_code': status_code})
            message = None
        LOG.debug('%(method)s    request    to    %(url)s    has    returned    with    a    status    code    of:    %(status_code)s.', {'method': method, 'url': url, 'status_code': status_code})
    except requests.Timeout:
        LOG.error('The    %(method)s    request    to    URL    %(url)s    timed-out,    but    may    have    been    successful.    Please    check    the    array.', {'method': method, 'url': url})
    except Exception as e:
        exception_message = (_('The    %(method)s    request    to    URL    %(url)s    failed    with    exception    %(e)s') % {'method': method, 'url': url, 'e': six.text_type(e)})
        LOG.exception(exception_message)
        raise exception.VolumeBackendAPIException(data=exception_message)
    return (status_code, message)
