def __new__(mcs, classname, baseclasses, attrs):
if not baseclasses:  <EOL><INDENT>raise TypeError("<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>which_base = [<EOL>base for base in baseclasses<EOL>if base == _BaseDistribution or issubclass(base, Distribution)]<EOL>base = which_base[<NUM_LIT:0>] if which_base else None<EOL>if base is None or base == _BaseDistribution:<EOL><INDENT>return super(_DistributionMeta, mcs).__new__(<EOL>mcs, classname, baseclasses, attrs)<EOL><DEDENT>if not issubclass(base, Distribution):<EOL><INDENT>raise TypeError("<STR_LIT>"<EOL>"<STR_LIT>".format(<EOL>classname, base.__name__))<EOL><DEDENT>for attr in _DISTRIBUTION_PUBLIC_METHOD_WRAPPERS:<EOL><INDENT>if attr in attrs:<EOL><INDENT>continue<EOL><DEDENT>special_attr = "<STR_LIT>".format(attr)<EOL>class_attr_value = attrs.get(attr, None)<EOL>base_attr_value = getattr(base, attr, None)<EOL>if not base_attr_value:<EOL><INDENT>raise AttributeError(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>".format(base.__name__, attr))<EOL><DEDENT>class_special_attr_value = attrs.get(special_attr, None)<EOL>if class_special_attr_value is None:<EOL><INDENT>continue<EOL><DEDENT>class_special_attr_docstring = tf_inspect.getdoc(class_special_attr_value)<EOL>if not class_special_attr_docstring:<EOL><INDENT>continue<EOL><DEDENT>class_attr_value = _copy_fn(base_attr_value)<EOL>class_attr_docstring = tf_inspect.getdoc(base_attr_value)<EOL>if class_attr_docstring is None:<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>".format(<EOL>base.__name__, attr))<EOL><DEDENT>class_attr_value.__doc__ = _update_docstring(<EOL>class_attr_value.__doc__,<EOL>"<STR_LIT>".format(<EOL>classname, class_special_attr_docstring))<EOL>attrs[attr] = class_attr_value<EOL><DEDENT>default_init = attrs.get("<STR_LIT>", None)<EOL>if default_init is None:<EOL><INDENT>return super(_DistributionMeta, mcs).__new__(<EOL>mcs, classname, baseclasses, attrs)<EOL><DEDENT>@decorator.decorator<EOL>def wrapped_init(wrapped, self_, *args, **kwargs):<EOL><INDENT>"""<STR_LIT>"""<EOL>del wrapped<EOL>self_._parameters = None<EOL>default_init(self_, *args, **kwargs)<EOL>if self_._parameters is None:<EOL><INDENT>dummy_self = tuple()<EOL>self_._parameters = lambda: (  <EOL>_remove_dict_keys_with_value(<EOL>inspect.getcallargs(default_init, dummy_self, *args, **kwargs),<EOL>dummy_self))<EOL><DEDENT>elif hasattr(self_._parameters, "<STR_LIT>"):<EOL><INDENT>self_._parameters = _remove_dict_keys_with_value(<EOL>self_._parameters, self_)<EOL><DEDENT><DEDENT>attrs["<STR_LIT>"] = wrapped_init(default_init)  <EOL>return super(_DistributionMeta, mcs).__new__(<EOL>mcs, classname, baseclasses, attrs)<EOL>
Control the creation of subclasses of the Distribution class.

        The main purpose of this method is to properly propagate docstrings
        from private Distribution methods, like `_log_prob`, into their
        public wrappers as inherited by the Distribution base class
        (e.g. `log_prob`).

        Args:
          classname: The name of the subclass being created.
          baseclasses: A tuple of parent classes.
          attrs: A dict mapping new attributes to their values.

        Returns:
          The class object.

        Raises:
          TypeError: If `Distribution` is not a subclass of `BaseDistribution`, or
            the new class is derived via multiple inheritance and the first
            parent class is not a subclass of `BaseDistribution`.
          AttributeError:  If `Distribution` does not implement e.g. `log_prob`.
          ValueError:  If a `Distribution` public method lacks a docstring.