<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def delete_node(self, node_id):
 """ Delete a node. The node working directory will be destroyed when a commit is received. :param node_id: Node identifier :returns: Node instance """


        node = None
        try:
            node = self.get_node(node_id)
            yield from self.close_node(node_id)
        finally:
            if node:
                node.project.emit("node.deleted", node)
                yield from node.project.remove_node(node)
        if node.id in self._nodes:
            del self._nodes[node.id]
        return node