def create_window(self, pane, name=None, set_active=True):
assert isinstance(pane, Pane)<EOL>assert name is None or isinstance(name, six.text_type)<EOL>taken_indexes = [w.index for w in self.windows]<EOL>index = self.base_index<EOL>while index in taken_indexes:<EOL><INDENT>index += <NUM_LIT:1><EOL><DEDENT>w = Window(index)<EOL>w.add_pane(pane)<EOL>self.windows.append(w)<EOL>self.windows = sorted(self.windows, key=lambda w: w.index)<EOL>app = get_app(return_none=True)<EOL>if app is not None and set_active:<EOL><INDENT>self.set_active_window(w)<EOL><DEDENT>if name is not None:<EOL><INDENT>w.chosen_name = name<EOL><DEDENT>assert w.active_pane == pane<EOL>assert w._get_parent(pane)<EOL>
Create a new window that contains just this pane.

:param pane: The :class:`.Pane` instance to put in the new window.
:param name: If given, name for the new window.
:param set_active: When True, focus the new window.