code: def _get_conda_like_executable(command):
      """Find the path to the given executable
  
      Parameters
      ----------
  
      executable: string
          Value should be: conda, mamba or micromamba
      """
      # Check if there is a conda executable in the same directory as the Python executable.
      # This is the case within conda's root environment.
      executable = Path(sys.executable).parent / command
      if executable.is_file():
          return str(executable)
  
      # Otherwise, attempt to extract the executable from conda history.
      # This applies in any conda environment.
      history = Path(sys.prefix, "conda-meta", "history").read_text(
          encoding="utf-8"
      )
      match = re.search(
          rf"^#\s*cmd:\s*(?P<command>.*{executable})\s[create|install]",
          history,
          flags=re.MULTILINE,
      )
      if match:
          return match.groupdict()["command"]
  
      # Fallback: assume the executable is available on the system path.
      return command
  
file_path: catboost/contrib/python/ipython/py3/IPython/core/magics/packaging.py
imports: import functools
  import re
  import shlex
  import sys
  from pathlib import Path
  from IPython.core.magic import Magics, magics_class, line_magic
label_desc: Use image node_id 2 for calling a global function with example usage: _get_conda_like_executable(command) and returns: command, str, match