code: def version_of_package(pkg: ModuleType) -> str | None:
      """Try a variety of common ways to get the version of a package"""
      from contextlib import suppress
  
      with suppress(AttributeError):
          return pkg.__version__
      with suppress(AttributeError):
          return str(pkg.version)
      with suppress(AttributeError):
          return ".".join(map(str, pkg.version_info))
      return None
  
file_path: distributed/distributed/versions.py
imports: from __future__ import annotations
  import importlib
  import os
  import platform
  import struct
  import sys
  from collections.abc import Callable, Iterable
  from itertools import chain
  from types import ModuleType
  from typing import Any
  from packaging.requirements import Requirement
label_desc: Use image node_id 3 for calling a global function with example usage: version_of_package(pkg) and returns: None, pkg, str, str