code: def version(root_path):
      """Returns the version taken from __init__.py
  
      Parameters
      ----------
      root_path : pathlib.Path
          path to the root of the package
  
      Reference
      ---------
      https://packaging.python.org/guides/single-sourcing-package-version/
      """
      version_path = root_path.joinpath("tensorly", "__init__.py")
      with version_path.open() as f:
          version_file = f.read()
      version_match = re.search(
          r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M
      )
      if version_match:
          return version_match.group(1)
      raise RuntimeError("Unable to find version string.")
  
imports: import re
  from pathlib import Path
label_desc: Use image node_id 1 for calling a global function with example usage: version(root_path) and returns: version_match