def _unify_call_signature(i, dist_fn):
if distribution_util.is_distribution_instance(dist_fn):<EOL><INDENT>return (lambda *_: dist_fn), None<EOL><DEDENT>if not callable(dist_fn):<EOL><INDENT>raise TypeError('<STR_LIT>'<EOL>'<STR_LIT>'.format(dist_fn))<EOL><DEDENT>args = _get_required_args(dist_fn)<EOL>if not args:<EOL><INDENT>return (lambda *_: dist_fn()), ()<EOL><DEDENT>@functools.wraps(dist_fn)<EOL>def dist_fn_wrapped(*xs):<EOL><INDENT>"""<STR_LIT>"""<EOL>if i != len(xs):<EOL><INDENT>raise ValueError(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'.format(<EOL>i, dist_fn, i, len(xs)))<EOL><DEDENT>if len(xs) < len(args):<EOL><INDENT>raise ValueError(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'.format(<EOL>i, dist_fn, len(args), len(xs)))<EOL><DEDENT>return dist_fn(*reversed(xs[-len(args):]))<EOL><DEDENT>return dist_fn_wrapped, args<EOL>
Creates `dist_fn_wrapped` which calls `dist_fn` with all prev nodes.

    Args:
      i: Python `int` corresponding to position in topologically sorted DAG.
      dist_fn: Python `callable` which takes a subset of previously constructed
        distributions (in reverse order) and produces a new distribution instance.

    Returns:
      dist_fn_wrapped: Python `callable` which takes all previous distributions
        (in non reverse order) and produces a  new distribution instance.
      args: `tuple` of `str` representing the arg names of `dist_fn` (and in non
        wrapped, "natural" order). `None` is returned only if the input is not a
        `callable`.