code: def versions_from_file(filename: str) -> Dict[str, Any]:
      """Try to determine the version from _version.py if present."""
      try:
          with open(filename) as f:
              contents = f.read()
      except OSError:
          raise NotThisMethod("unable to read _version.py")
      mo = re.search(
          r"version_json = '''\n(.*)'''  # END VERSION_JSON",
          contents,
          re.M | re.S,
      )
      if not mo:
          mo = re.search(
              r"version_json = '''\r\n(.*)'''  # END VERSION_JSON",
              contents,
              re.M | re.S,
          )
      if not mo:
          raise NotThisMethod("no version_json in _version.py")
      return json.loads(mo.group(1))
  
imports: import configparser
  import errno
  import json
  import os
  import re
  import subprocess
  import sys
  from pathlib import Path
  from typing import Any, Callable, cast, Dict, List, Optional, Tuple, Union
  from typing import NoReturn
  import functools
label_desc: Use image node_id 10 for calling a global function with example usage: versions_from_file(filename) and returns: json