docs: def get_url(url, parser='html'):
      """
      Requests the specified url and returns a BeautifulSoup object with its
      contents.
      """
      url = request.quote(url, safe=':/?=&')
      logger.debug('URL: %s', url)
      req = request.Request(url, headers={'User-Agent': 'foobar'})
      try:
          response = request.urlopen(req)
      except HTTPError:
          raise
      except (ssl.SSLError, URLError):
          # Some websites (like metal-archives) use older TLS versions and can
          # make the ssl module trow a VERSION_TOO_LOW error. Here we try to use
          # the older TLSv1 to see if we can fix that
          context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
          response = request.urlopen(req, context=context)
  
      response = response.read()
      if parser == 'html':
          return BeautifulSoup(response, 'html.parser', from_encoding='utf-8')
      elif parser == 'json':
          return json.loads(response)
      elif parser == 'raw':
          return response.decode()
      raise ValueError('Unrecognized parser')