def send_request(user_session, method, request):
    """
    Send request to SMC
    
    :param Session user_session: session object
    :param str method: method for request
    :param SMCRequest request: request object
    :raises SMCOperationFailure: failure with reason
    :rtype: SMCResult
    """
    if user_session.session:
        session = user_session.session # requests session
        try:
            method = method.upper() if method else ''
            
            if method == GET:
                if request.filename:  # File download request
                    return file_download(user_session, request)
                
                response = session.get(
                    request.href,
                    params=request.params,
                    headers=request.headers,
                    timeout=user_session.timeout)
                
                response.encoding = 'utf-8'
                
                counters.update(read=1)

                if logger.isEnabledFor(logging.DEBUG):
                    debug(response)
                
                if response.status_code not in (200, 204, 304):
                    raise SMCOperationFailure(response)

            elif method == POST:
                if request.files:  # File upload request
                    return file_upload(user_session, method, request)
                
                response = session.post(
                    request.href,
                    data=json.dumps(request.json, cls=CacheEncoder),
                    headers=request.headers,
                    params=request.params)
                
                response.encoding = 'utf-8'

                counters.update(create=1)
                if logger.isEnabledFor(logging.DEBUG):
                    debug(response)
                
                if response.status_code not in (200, 201, 202):
                    # 202 is asynchronous response with follower link
                    raise SMCOperationFailure(response)

            elif method == PUT:
                if request.files:  # File upload request
                    return file_upload(user_session, method, request)
                
                # Etag should be set in request object
                request.headers.update(Etag=request.etag)
                
                response = session.put(
                    request.href,
                    data=json.dumps(request.json, cls=CacheEncoder),
                    params=request.params,
                    headers=request.headers)

                counters.update(update=1)
                
                if logger.isEnabledFor(logging.DEBUG):
                    debug(response)

                if response.status_code != 200:
                    raise SMCOperationFailure(response)

            elif method == DELETE:
                response = session.delete(
                    request.href,
                    headers=request.headers)

                counters.update(delete=1)

                # Conflict (409) if ETag is not current
                if response.status_code in (409,):
                    req = session.get(request.href)
                    etag = req.headers.get('ETag')
                    response = session.delete(
                        request.href,
                        headers={'if-match': etag})

                response.encoding = 'utf-8'

                if logger.isEnabledFor(logging.DEBUG):
                    debug(response)
                
                if response.status_code not in (200, 204):
                    raise SMCOperationFailure(response)

            else:  # Unsupported method
                return SMCResult(msg='Unsupported method: %s' % method,
                    user_session=user_session)

        except SMCOperationFailure as error:
            if error.code in (401,):
                user_session.refresh()
                return send_request(user_session, method, request)
            raise error
        except requests.exceptions.RequestException as e:
            raise SMCConnectionError('Connection problem to SMC, ensure the API '
                'service is running and host is correct: %s, exiting.' % e)
        else:
            return SMCResult(response, user_session=user_session)
    else:
        raise SMCConnectionError('No session found. Please login to continue')
Send request to SMC
    
    :param Session user_session: session object
    :param str method: method for request
    :param SMCRequest request: request object
    :raises SMCOperationFailure: failure with reason
    :rtype: SMCResult