code: def inflated_factory(
      default_name, distribution_class, inflated_loc, **more_kwargs
  ):
      """Create Inflated subclasses for specific distributions and positions.
  
      Example usages:
        SpikeAndSlab = inflated_factory('SpikeAndSlab', tfd.Normal, 0.0)
        s_and_s = SpikeAndSlab(inflated_loc_probs=0.3, loc=5.0, scale=2.0)
  
        ZeroInflatedNegativeBinomial = inflated_factory(
            'ZeroInflatedNegativeBinomial', tfd.NegativeBinomial, 0.0)
        zinb = ZeroInflatedNegativeBinomial(inflated_loc_probs=0.2, probs=0.5,
                                            total_count=10.0)
  
      Args:
        default_name:  The name of the subclass, unless the user passes a
          name argument to init.
        distribution_class:  A tfd.Distribution class.
        inflated_loc:  The scalar position to inflate.
        **more_kwargs: Additional keyword arguments to pass to the
          distribution_class.
  
      Returns:
        A Inflated subclass that is the inflated version of distribution_class.
      """
  
      def my_init(
          self,
          inflated_loc_logits=None,
          inflated_loc_probs=None,
          name=default_name,
          **kwargs,
      ):
          parameters = dict(locals())
          if "distribution" in kwargs:
              dist = kwargs["distribution"]
          else:
              dist = distribution_class(**{**kwargs, **more_kwargs})
          Inflated.__init__(
              self,
              dist,
              inflated_loc_logits,
              inflated_loc_probs,
              inflated_loc,
              name=name,
          )
          # pylint: disable=protected-access
          self._parameters = {**parameters, **more_kwargs}
          # pylint: enable=protected-access
  
      def my_parameter_properties(unused_cls, dtype, num_classes=None):
          return dict(
              inflated_loc_logits=parameter_properties.ParameterProperties(),
              inflated_loc_probs=parameter_properties.ParameterProperties(
                  default_constraining_bijector_fn=sigmoid_bijector.Sigmoid,
                  is_preferred=False,
              ),
              **distribution_class.parameter_properties(
                  dtype, num_classes
              ),
          )
  
      # In order to make auto_composite_tensor work, we need to do two things:
      # 1) Define property methods for each of the distribution_class's
      # constructor arguments, and
      # 2) Fool auto_composite_tensor into thinking those arguments are present
      # in the __init__ method for the Inflated subclass we are creating.  This
      # we do by inserting the "corrected" signature into auto_composite_tensor's
      # cache.
  
      methods_dict = {
          "__init__": my_init,
          "_parameter_properties": classmethod(my_parameter_properties),
      }
  
      distribution_signature = inspect.signature(
          distribution_class.__init__
      )
      for p in distribution_signature.parameters.keys():
          if p == "name":
              continue
  
          def property_getter(self, param=p):
              # pylint: disable=protected-access
              return getattr(self._distribution, param)
  
          # pylint: enable=protected-access
          methods_dict[p] = property(property_getter)
      for k, v in more_kwargs.items():
  
          def another_property_getter(unused_self, value=v):
              return value
  
          methods_dict[k] = property(another_property_getter)
  
      newclass = type(default_name, (Inflated,), methods_dict)
  
      init_fn_signature = inspect.signature(my_init)
      new_parameters = tuple(
          list(distribution_signature.parameters.values())
          + [
              init_fn_signature.parameters["inflated_loc_logits"],
              init_fn_signature.parameters["inflated_loc_probs"],
          ]
      )
      new_signature = init_fn_signature.replace(
          parameters=new_parameters
      )
      # pylint: disable=protected-access
      auto_composite_tensor._sig_cache[
          newclass.__init__
      ] = new_signature
      # pylint: enable=protected-access
  
      return newclass
  
imports: import inspect
  import warnings
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import sigmoid
  from tensorflow_probability.python.distributions import categorical
  from tensorflow_probability.python.distributions import deterministic
  from tensorflow_probability.python.distributions import distribution
  from tensorflow_probability.python.distributions import mixture
  from tensorflow_probability.python.distributions import negative_binomial
  from tensorflow_probability.python.internal import auto_composite_tensor
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import parameter_properties
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import samplers
  from tensorflow_probability.python.internal import tensor_util
  from tensorflow_probability.python.util.deferred_tensor import DeferredTensor
label_desc: Use image node_id 2 for calling a global function with example usage: inflated_factory(default_name, distribution_class, inflated_loc) and returns: newclass, dict, getattr, value