'Disconnects the given (node,port)'

def disconnect_port(self, np):

    assert (type(np) is tuple)
    remove = []
    if (self.port_for_node(np[0], np[1]) is None):
        return 0
    for (n1, n2, k, d) in self._g.edges([np[0], self.node_port[np[0]][np[1]][0]], data=True, keys=True):
        if (np in d[LINK]):
            remove.append((n1, n2, k))
            del self.node_port[n1][d[LINK][n1][1]]
            del self.node_port[n2][d[LINK][n2][1]]
    for e in remove:
        self._g.remove_edge(*e)
    return len(remove)
