code: def _check_callables(x, dct, varname):
      if callable(x):
          return x
      if isinstance(x, str):
          try:
              return dct[x]
          except KeyError:
              valid_keys = list(dct.keys())
              raise ValueError(
                  "%s can be a callable or a string in %s"
                  % (varname, str(valid_keys))
              )
      raise TypeError(
          "expected a callable or a string, but got %r (type=%s)"
          % (x, type(x))
      )
  
imports: import numpy
  import numbers
  import warnings
  import time
  from traceback import format_exception_only
  from sklearn import base
  from sklearn.metrics import mean_absolute_error, mean_squared_error
  from sklearn.utils import indexable
  from ._split import check_cv
  from ..None import metrics
  from ..utils import check_endog
  from ..warnings import ModelFitWarning
  from ..compat.sklearn import safe_indexing
label_desc: Use image node_id 1 for calling a global function with example usage: _check_callables(x, dct, varname) and returns: x, dct