docs: def get_html_tree(filename_url_or_filelike):
      """From some file path, input stream, or URL, construct and return
      an HTML tree.
      """
      try:
          handler = (
              HTTPSHandler
                  if filename_url_or_filelike.lower().startswith('https')
                  else HTTPHandler
          )
          cj = CookieJar()
          opener = build_opener(handler)
          opener.add_handler(HTTPCookieProcessor(cj))
  
          resp = opener.open(filename_url_or_filelike)
      except(AttributeError):
          content = filename_url_or_filelike.read()
          encoding = chardet.detect(content)['encoding']
  
          parsed_html = html.parse(BytesIO(content),
                                   html.HTMLParser(encoding=encoding,
                                                   remove_blank_text=True))
  
          return parsed_html
      except(ValueError):
          content = filename_url_or_filelike
          encoding = chardet.detect(content)['encoding']
  
          parsed_html = html.parse(BytesIO(content),
                                   html.HTMLParser(encoding=encoding,
                                                   remove_blank_text=True))
  
          return parsed_html
  
      try:
          content = resp.read()
      finally:
          resp.close()
  
      encoding = chardet.detect(content)['encoding']
  
      parsed_html = html.parse(BytesIO(content),
                               html.HTMLParser(encoding=encoding,
                                               remove_blank_text=True))
  
      return parsed_html