code: def _get_data(url):
      """Helper function to get data over http(s) or from a local file"""
      if urllib_parse.urlparse(url).scheme in ("http", "https"):
          resp = urllib_request.urlopen(url)
          encoding = resp.headers.get("content-encoding", "plain")
          data = resp.read()
          if encoding == "plain":
              data = data.decode("utf-8")
          elif encoding == "gzip":
              data = StringIO(data)
              data = gzip.GzipFile(fileobj=data).read().decode("utf-8")
          else:
              raise RuntimeError("unknown encoding")
      else:
          with codecs.open(url, mode="r", encoding="utf-8") as fid:
              data = fid.read()
  
      return data
  
imports: from __future__ import print_function
  import codecs
  import gzip
  import os
  import posixpath
  import re
  import shelve
  import sys
  from io import StringIO
  from .None import sphinx_compatibility
label_desc: Use image node_id 1 for calling a global function with example usage: _get_data(url) and returns: data