code: def file_upload(user_session, method, request):
      
      logger.debug('Upload: %s', vars(request))
      http_command = getattr(user_session.session, method.lower())
      
      try:
          response = http_command(
              request.href,
              params=request.params,
              files=request.files)
      except AttributeError:
          raise TypeError('File specified in request was not readable: %s' % request.files)
      else:
          if response.status_code in (200, 201, 202, 204):
              logger.debug('Success sending file in elapsed time: %s', response.elapsed)
              return SMCResult(response, user_session=user_session)
          
          raise SMCOperationFailure(response)
docs: Perform a file upload PUT/POST to SMC. Request should have the
      files attribute set which will be an open handle to the
      file that will be binary transfer.
      
      :param Session user_session: session object
      :param str method: method to use, could be put or post
      :param SMCRequest request: request object
      :raises SMCOperationFailure: failure with reason
      :rtype: SMCResult