docs: def urlopen(url, method=None, params=None, data=None, json=None,
              headers=None, allow_redirects=False, timeout=30,
              verify_ssl=True, user_agent=None):
      """
      A slightly safer version of ``urlib2.urlopen`` which prevents redirection
      and ensures the URL isn't attempting to hit a blacklisted IP range.
      """
      if user_agent is not None:
          warnings.warn('user_agent is no longer used with safe_urlopen')
  
      session = build_session()
  
      kwargs = {}
  
      if json:
          kwargs['json'] = json
          if not headers:
              headers = {}
          headers.setdefault('Content-Type', 'application/json')
  
      if data:
          kwargs['data'] = data
  
      if params:
          kwargs['params'] = params
  
      if headers:
          kwargs['headers'] = headers
  
      if method is None:
          method = 'POST' if (data or json) else 'GET'
  
      try:
          response = session.request(
              method=method,
              url=url,
              allow_redirects=allow_redirects,
              timeout=timeout,
              verify=verify_ssl,
              **kwargs
          )
      # Our version of requests does not transform ZeroReturnError into an
      # appropriately generically catchable exception
      except ZeroReturnError as exc:
          import sys
          exc_tb = sys.exc_info()[2]
          six.reraise(SSLError, exc, exc_tb)
          del exc_tb
  
      # requests' attempts to use chardet internally when no encoding is found
      # and we want to avoid that slow behavior
      if not response.encoding:
          response.encoding = 'utf-8'
  
      return response