def remove_pane(self, pane):
assert isinstance(pane, Pane)<EOL>if pane in self.panes:<EOL><INDENT>if pane == self.active_pane:<EOL><INDENT>if self.previous_active_pane:<EOL><INDENT>self.active_pane = self.previous_active_pane<EOL><DEDENT>else:<EOL><INDENT>self.focus_next()<EOL><DEDENT><DEDENT>p = self._get_parent(pane)<EOL>p.remove(pane)<EOL>while len(p) == <NUM_LIT:0> and p != self.root:<EOL><INDENT>p2 = self._get_parent(p)<EOL>p2.remove(p)<EOL>p = p2<EOL><DEDENT>while len(p) == <NUM_LIT:1> and p != self.root:<EOL><INDENT>p2 = self._get_parent(p)<EOL>p2.weights[p[<NUM_LIT:0>]] = p2.weights[p]  <EOL>i = p2.index(p)<EOL>p2[i] = p[<NUM_LIT:0>]<EOL>p = p2<EOL><DEDENT><DEDENT>
Remove pane from this Window.