code: def convert_strs_to_vars(
      x: Union[tuple, str, dict],
      var_map: Optional[dict[str, Var]] = None,
  ) -> Union[ExpressionTuple, Var]:
      r"""Convert tuples and strings to `etuple`\s and logic variables, respectively.
  
      Constrained logic variables are specified via `dict`s with the keys
      `"pattern"`, which specifies the logic variable as a string, and
      `"constraint"`, which provides the `Callable` constraint.
      """
      if var_map is None:
          var_map = {}
  
      def _convert(y):
          if isinstance(y, str):
              v = var_map.get(y, var(y))
              var_map[y] = v
              return v
          elif isinstance(y, dict):
              pattern = y["pattern"]
              if not isinstance(pattern, str):
                  raise TypeError(
                      "Constraints can only be assigned to logic variables (i.e. strings)"
                  )
              constraint = y["constraint"]
              v = var_map.get(
                  pattern, ConstrainedVar(constraint, pattern)
              )
              var_map[pattern] = v
              return v
          elif isinstance(y, tuple):
              return etuple(*tuple(_convert(e) for e in y))
          elif isinstance(y, (Number, np.ndarray)):
              from pytensor.tensor import as_tensor_variable
  
              return as_tensor_variable(y)
          return y
  
      return _convert(x)
  
imports: from collections.abc import Mapping
  from numbers import Number
  from typing import Optional, Union
  import numpy
  from cons.core import ConsError, _car, _cdr
  from etuples import apply, etuple, etuplize
  from etuples.core import ExpressionTuple
  from unification.core import _unify, assoc
  from unification.utils import transitive_get
  from unification.variable import Var, isvar, var
  from pytensor.graph.basic import Constant, Variable
  from pytensor.graph.op import Op
  from pytensor.graph.type import Type
label_desc: Use image node_id 14 for calling a global function with example usage: convert_strs_to_vars(x, var_map) and returns: _convert, y, v, v, etuple, as_tensor_variable