code: def str_for_potential_or_deterministic(
      var: TensorVariable,
      formatting: str = "plain",
      include_params: bool = True,
      dist_name: str = "Deterministic",
  ) -> str:
      """Make a human-readable string representation of a Deterministic or Potential in a model, either
      LaTeX or plain, optionally with distribution parameter values included.
      """
      print_name = var.name if var.name is not None else "<unnamed>"
      if "latex" in formatting:
          print_name = (
              r"\text{" + _latex_escape(print_name.strip("$")) + "}"
          )
          if include_params:
              return rf"${print_name} \sim \operatorname{{{dist_name}}}({_str_for_expression(var, formatting=formatting)})$"
          else:
              return (
                  rf"${print_name} \sim \operatorname{{{dist_name}}}$"
              )
      else:  # plain
          if include_params:
              return rf"{print_name} ~ {dist_name}({_str_for_expression(var, formatting=formatting)})"
          else:
              return rf"{print_name} ~ {dist_name}"
  
file_path: pymc/pymc/printing.py
imports: from typing import Union
  from pytensor.compile import SharedVariable
  from pytensor.graph.basic import Constant, walk
  from pytensor.tensor.basic import TensorVariable, Variable
  from pytensor.tensor.elemwise import DimShuffle
  from pytensor.tensor.random.basic import RandomVariable
  from pytensor.tensor.random.var import RandomGeneratorSharedVariable, RandomStateSharedVariable
  from pymc.model import Model
label_desc: Use image node_id 3 for calling a global function with example usage: str_for_potential_or_deterministic(var, formatting, include_params, dist_name) and returns: str, print_name, str, dist_name, str, _str_for_expression, str, str, print_name, str, dist_name, str, print_name, str, dist_name, str, _str_for_expression, str, print_name, str, dist_name