  
      def add_node(self, key):
          if key is None:
              raise TypeError('key cannot be None')
          if key in self.nodes:
              return self.nodes[key]
          self.nodes[key] = Node(key)
          return self.nodes[key]
  
      def add_edge(self, source_key, dest_key, weight=0):
          if source_key is None or dest_key is None:
              raise Exception('Invalid key')
 
</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", </s> remove         self.nodes[source_key].add_neighbor(self.nodes[dest_key],
                                            weight)
 </s> add         self.nodes[source_key].add_neighbor(self.nodes[dest_key], weight) </s> remove             raise Exception('Invalid key')
 </s> add             raise KeyError('Invalid key') </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')\n",
 </s> add     "            raise KeyError('Invalid key')\n",
        if key not in self.nodes:
            self.nodes[key] = Node(key)
  
      def add_node(self, key):
          if key is None:
              raise TypeError('key cannot be None')
        if key not in self.nodes:
            self.nodes[key] = Node(key)
        if key not in self.nodes:
            self.nodes[key] = Node(key)
        if key not in self.nodes:
            self.nodes[key] = Node(key)
          return self.nodes[key]
  
      def add_edge(self, source_key, dest_key, weight=0):
          if source_key is None or dest_key is None:
              raise Exception('Invalid key')
keep keep keep keep replace 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