code: def add_node(self, node):
          
          other_nodes = [n for n in self.nodes() if n.id != node.id]
  
          if isinstance(node, Source) and other_nodes:
              raise(Exception("Chain network already has a nodes, "
                              "can't add a source."))
  
          if other_nodes:
              parent = max(other_nodes, key=attrgetter('creation_time'))
              parent.connect(whom=node)
docs: Add an agent, connecting it to the previous node.