code: def namedtuple_with_defaults(typename, field_names, default_values=[]):
      
      the_tuple = collections.namedtuple(typename, field_names)
      the_tuple.__new__.__defaults__ = (None, ) * len(the_tuple._fields)
      if isinstance(default_values, collections.Mapping):
          prototype = the_tuple(**default_values)
      else:
          prototype = the_tuple(*default_values)
      the_tuple.__new__.__defaults__ = tuple(prototype)
      return the_tuple
docs: Create a namedtuple with default values
  
      >>> Node = namedtuple_with_defaults('Node', 'val left right')
      >>> Node()
      Node(val=None, left=None, right=None)
      >>> Node = namedtuple_with_defaults('Node', 'val left right', [1, 2, 3])
      >>> Node()
      Node(val=1, left=2, right=3)
      >>> Node = namedtuple_with_defaults('Node', 'val left right', {'right':7})
      >>> Node()
      Node(val=None, left=None, right=7)
      >>> Node(4)
      Node(val=4, left=None, right=7)