class_docstr: Magic object referring to the local variables in a function definition.
  
  Obtain with `ProgramBuilder.vars`.  Overrides `setattr` and `getattr` to
  provide a smooth interface to reading and defining variables:
  
  - `ProgramBuilder.var.foo = ProgramBuilder.{call,primop}`
    records an assignment to the auto-batched variable `foo`, possibly
    binding it, and
  
  - `ProgramBuilder.var.foo` reads from the auto-batched variable `foo`
    (if it is bound).
code: def __setattr__(self, name, item):
      # _MagicVars is meant to be a friend class of ProgramBuilder; is purposely
      # a wrapper around the otherwise-private _locals field.
      # pylint: disable=protected-access
      if item is not None and item.vars_out:
          raise ValueError(
              "Outputs should be either declared explicitly "
              "or through `context.var`, but not both"
          )
      context = self._context
      if name not in context._locals:
          # Updates context._locals
          context.local(name)
      variable = context._locals[name]
      if item is not None:
          context._update_last_instruction(
              item.replace(vars_out=str(variable))
          )
      context._mark_defined(variable)
      return variable
  
imports: import collections
  import contextlib
  import inspect
  from tensorflow_probability.python.experimental.auto_batching import instructions
label_desc: Use image node_id 2 for calling the _MagicVars obj's underlying member method code with example usage: obj.__setattr__(name, item) and returns: variable