code: def configure_logging(verbosity):
      '''configure logging via verbosity level of between 0 and 2 corresponding
      to log levels warning, info and debug respectfully.'''
      log_level = max(logging.DEBUG, logging.WARNING - logging.DEBUG*verbosity)
      logging.basicConfig(
          stream=sys.stderr, level=log_level,
          format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
      )
  
      urllib3_logger = logging.getLogger(
          'requests.packages.urllib3')
      urllib3_logger.setLevel(log_level)
  
      # if debug level set then its nice to see the headers of the request
      if log_level == logging.DEBUG:
          try:
              import http.client as http_client
          except ImportError:
              # Python 2
              import httplib as http_client
          http_client.HTTPConnection.debuglevel = f configure_logging(verbosity):
      '''configure logging via verbosity level of between 0 and 2 corresponding
      to log levels warning, info and debug respectfully.'''
      log_level = max(logging.DEBUG, logging.WARNING - logging.DEBUG*verbosity)
      logging.basicConfig(
          stream=sys.stderr, level=log_level,
          format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
      )
  
      urllib3_logger = logging.getLogger(
          'requests.packages.urllib3')
      urllib3_logger.setLevel(log_level)
  
      # if debug level set then its nice to see the headers of the request
      if log_level == logging.DEBUG:
          try:
              import http.client as http_client
          except ImportError:
              # Python 2
              import httplib as http_client
          http_client.HTTPConnection.debuglevel = 1
docs: configure logging via verbosity level of between 0 and 2 corresponding
      to log levels warning, info and debug respectfully.