code: def collect_environment(no_cache: bool = False) -> dict:
      
      global _env
      if _env is None or no_cache:
          _env = collect_environment_without_packages()
          _env["packages"] = collect_loaded_packages()
      return _env
docs: Return the version of the Python executable, the versions of the currently loaded packages \
      and the running platform.
  
      The result is cached unless `no_cache` is True.