code: def as_symbolic(
      x: Any, name: Optional[str] = None, **kwargs
  ) -> Variable:
      """Convert `x` into an equivalent PyTensor `Variable`.
  
      Parameters
      ----------
      x
          The object to be converted into a ``Variable`` type. A
          ``numpy.ndarray`` argument will not be copied, but a list of numbers
          will be copied to make an ``numpy.ndarray``.
      name
          If a new ``Variable`` instance is created, it will be named with this
          string.
      kwargs
          Options passed to the appropriate sub-dispatch functions.  For example,
          `ndim` and `dtype` can be passed when `x` is an `numpy.ndarray` or
          `Number` type.
  
      Raises
      ------
      TypeError
          If `x` cannot be converted to a `Variable`.
  
      """
      if isinstance(x, Variable):
          return x
  
      res = _as_symbolic(x, **kwargs)
      res.name = name
      return res
  
imports: import logging
  import os
  import sys
  from functools import singledispatch
  from typing import Any, NoReturn, Optional
  from pytensor.version import version
  from pytensor.configdefaults import config
  from pytensor.graph.basic import Variable
  from pytensor.graph.replace import clone_replace, graph_replace
  from pytensor import scalar, tensor
  from pytensor.compile import In, Mode, Out, ProfileStats, predefined_linkers, predefined_modes, predefined_optimizers, shared
  from pytensor.compile.function import function, function_dump
  from pytensor.compile.function.types import FunctionMaker
  from pytensor.gradient import Lop, Rop, grad, subgraph_grad
  from pytensor.printing import debugprint
  from pytensor.printing import pp, pprint
  from pytensor.updates import OrderedUpdates
  import pytensor.tensor.random.var
  import pytensor.sparse
  from pytensor.scan import checkpoints
  from pytensor.scan.basic import scan
  from pytensor.scan.views import foldl, foldr, map, reduce
label_desc: Use image node_id 2 for calling a global function with example usage: as_symbolic(x, name) and returns: res, x