code: def prefer_environment_over_user() -> bool:
      """Determine if environment-level paths should take precedence over user-level paths."""
      # If JUPYTER_PREFER_ENV_PATH is defined, that signals user intent, so return its value
      if "JUPYTER_PREFER_ENV_PATH" in os.environ:
          return envset(
              "JUPYTER_PREFER_ENV_PATH"
          )  # type:ignore[return-value]
  
      # If we are in a Python virtualenv, default to True (see https://docs.python.org/3/library/venv.html#venv-def)
      if sys.prefix != sys.base_prefix and _do_i_own(sys.prefix):
          return True
  
      # If sys.prefix indicates Python comes from a conda/mamba environment that is not the root environment, default to True
      if (
          "CONDA_PREFIX" in os.environ
          and sys.prefix.startswith(os.environ["CONDA_PREFIX"])
          and os.environ.get("CONDA_DEFAULT_ENV", "base") != "base"
          and _do_i_own(sys.prefix)
      ):
          return True
  
      return False
  
imports: from __future__ import annotations
  import errno
  import os
  import site
  import stat
  import sys
  import tempfile
  import warnings
  from contextlib import contextmanager
  from pathlib import Path
  from typing import Any, Iterator, Optional
  import platformdirs
  from .utils import deprecation
label_desc: Use image node_id 5 for calling a global function with example usage: prefer_environment_over_user() and returns: False, envset, True, True