code: def get_version(package, url_pattern=URL_PATTERN):
      """Return version of package on pypi.python.org using json."""
      req = requests.get(url_pattern.format(package=package))
      version = parse("0")
      if req.status_code == requests.codes.ok:
          j = json.loads(req.text.encode(req.encoding))
          releases = j.get("releases", [])
          for release in releases:
              ver = parse(release)
              if not ver.is_prerelease:
                  version = max(version, ver)
      return version
  
file_path: h2ogpt/tests/test_requirements.py
imports: import pkg_resources
  from pkg_resources import DistributionNotFound, VersionConflict
  from src.utils import remove
  from tests.utils import wrap_test_forked
  import requests
  import json
label_desc: Use image node_id 4 for calling a global function with example usage: get_version(package, url_pattern) and returns: version