          if source_key not in self.nodes:
              self.add_node(source_key)
          if dest_key not in self.nodes:
              self.add_node(dest_key)
          self.nodes[source_key].add_neighbor(self.nodes[dest_key],
                                              weight)
  
      def add_undirected_edge(self, src_key, dst_key, weight=0):
          if src_key is None or dst_key is None:
              raise TypeError('key cannot be None')
          self.add_edge(src_key, dst_key, weight)
 
</s> remove     "        self.nodes[source_key].add_neighbor(self.nodes[dest_key],\n",
    "                                            weight)\n",
 </s> add     "        self.nodes[source_key].add_neighbor(self.nodes[dest_key], weight)\n", </s> remove             raise Exception('Invalid key')
 </s> add             raise KeyError('Invalid key') </s> remove         if key in self.nodes:
            return self.nodes[key]
        self.nodes[key] = Node(key)
 </s> add         if key not in self.nodes:
            self.nodes[key] = Node(key) </s> remove     "            raise Exception('Invalid key')\n",
 </s> add     "            raise KeyError('Invalid key')\n", </s> remove     "        if key in self.nodes:\n",
    "            return self.nodes[key]\n",
    "        self.nodes[key] = Node(key)\n",
 </s> add     "        if key not in self.nodes:\n",
    "            self.nodes[key] = Node(key)\n",
        self.nodes[source_key].add_neighbor(self.nodes[dest_key], weight)
          if source_key not in self.nodes:
              self.add_node(source_key)
          if dest_key not in self.nodes:
              self.add_node(dest_key)
        self.nodes[source_key].add_neighbor(self.nodes[dest_key], weight)
        self.nodes[source_key].add_neighbor(self.nodes[dest_key], weight)
  
      def add_undirected_edge(self, src_key, dst_key, weight=0):
          if src_key is None or dst_key is None:
              raise TypeError('key cannot be None')
          self.add_edge(src_key, dst_key, weight)
keep keep keep keep replace replace keep keep keep keep keep
 Update graph challenge (#122)

Simplify add_node logic.  Use more specific TypeError Exception. 
graphs_trees/graph/graph.py