<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def namedtuple_with_defaults(typename: str, field_names: Union[str, List[str]], default_values: collections.Iterable = ()):
 """ Convenience function for defining a namedtuple with default values From: https://stackoverflow.com/questions/11351032/namedtuple-and-default-values-for-optional-keyword-arguments Examples: Node(val=None, left=None, right=None) Node(val=1, left=2, right=3) Node(val=None, left=None, right=7) Node(val=4, left=None, right=7) """

    T = collections.namedtuple(typename, field_names)
    # noinspection PyProtectedMember,PyUnresolvedReferences
    T.__new__.__defaults__ = (None,) * len(T._fields)
    if isinstance(default_values, collections.Mapping):
        prototype = T(**default_values)
    else:
        prototype = T(*default_values)
    T.__new__.__defaults__ = tuple(prototype)
    return T