code: def _check_engine(engine):
      """Make sure a valid engine is passed.
  
      Parameters
      ----------
      engine : str
  
      Raises
      ------
      KeyError
        * If an invalid engine is passed
      ImportError
        * If numexpr was requested but doesn't exist
  
      Returns
      -------
      string engine
  
      """
      from pandas.core.computation.check import _NUMEXPR_INSTALLED
  
      if engine is None:
          if _NUMEXPR_INSTALLED:
              engine = "numexpr"
          else:
              engine = "python"
  
      if engine not in _engines:
          valid = list(_engines.keys())
          raise KeyError(
              "Invalid engine {engine!r} passed, valid engines are"
              " {valid}".format(engine=engine, valid=valid)
          )
  
      # TODO: validate this in a more general way (thinking of future engines
      # that won't necessarily be import-able)
      # Could potentially be done on engine instantiation
      if engine == "numexpr":
          if not _NUMEXPR_INSTALLED:
              raise ImportError(
                  "'numexpr' is not installed or an "
                  "unsupported version. Cannot use "
                  "engine='numexpr' for query/eval "
                  "if 'numexpr' is not installed"
              )
  
      return engine
  
file_path: catboost/contrib/python/pandas/py2/pandas/core/computation/eval.py
imports: import tokenize
  import warnings
  from pandas.compat import string_types
  from pandas.util._validators import validate_bool_kwarg
  from pandas.core.computation.engines import _engines
  from pandas.core.computation.scope import _ensure_scope
  from pandas.io.formats.printing import pprint_thing
label_desc: Use image node_id 1 for calling a global function with example usage: _check_engine(engine) and returns: engine