code: def _try_get_same_env():
      env = SameEnvironment()
      if (
          not os.path.basename(env.executable)
          .lower()
          .startswith("python")
      ):
          # This tries to counter issues with embedding. In some cases (e.g.
          # VIM's Python Mac/Windows, sys.executable is /foo/bar/vim. This
          # happens, because for Mac a function called `_NSGetExecutablePath` is
          # used and for Windows `GetModuleFileNameW`. These are both platform
          # specific functions. For all other systems sys.executable should be
          # alright. However here we try to generalize:
          #
          # 1. Check if the executable looks like python (heuristic)
          # 2. In case it's not try to find the executable
          # 3. In case we don't find it use an interpreter environment.
          #
          # The last option will always work, but leads to potential crashes of
          # Jedi - which is ok, because it happens very rarely and even less,
          # because the code below should work for most cases.
          if os.name == "nt":
              # The first case would be a virtualenv and the second a normal
              # Python installation.
              checks = (r"Scripts\python.exe", "python.exe")
          else:
              # For unix it looks like Python is always in a bin folder.
              checks = (
                  "bin/python%s.%s"
                  % (sys.version_info[0], sys.version[1]),
                  "bin/python%s" % (sys.version_info[0]),
                  "bin/python",
              )
          for check in checks:
              guess = os.path.join(sys.exec_prefix, check)
              if os.path.isfile(guess):
                  # Bingo - We think we have our Python.
                  return Environment(guess)
          # It looks like there is no reasonable Python to be found.
          return InterpreterEnvironment()
      # If no virtualenv is found, use the environment we're already
      # using.
      return env
  
imports: import os
  import sys
  import hashlib
  import filecmp
  from collections import namedtuple
  from jedi._compatibility import highest_pickle_protocol, which
  from jedi.cache import memoize_method, time_cache
  from jedi.evaluate.compiled.subprocess import CompiledSubprocess, EvaluatorSameProcess, EvaluatorSubprocess
  import parso
label_desc: Use image node_id 5 for calling a global function with example usage: _try_get_same_env() and returns: env, InterpreterEnvironment, Environment