def _create_pane(self, window=None, command=None, start_directory=None):
assert window is None or isinstance(window, Window)<EOL>assert command is None or isinstance(command, six.text_type)<EOL>assert start_directory is None or isinstance(start_directory, six.text_type)<EOL>def done_callback():<EOL><INDENT>"<STR_LIT>"<EOL>if not self.remain_on_exit:<EOL><INDENT>self.arrangement.remove_pane(pane)<EOL>if not self.arrangement.has_panes:<EOL><INDENT>self.stop()<EOL><DEDENT>for client_state in self._client_states.values():<EOL><INDENT>client_state.sync_focus()<EOL><DEDENT><DEDENT>self.invalidate()<EOL><DEDENT>def bell():<EOL><INDENT>"<STR_LIT>"<EOL>if self.enable_bell:<EOL><INDENT>for c in self.apps:<EOL><INDENT>c.output.bell()<EOL><DEDENT><DEDENT><DEDENT>if start_directory:<EOL><INDENT>path = start_directory<EOL><DEDENT>elif window and window.active_process:<EOL><INDENT>path = window.active_process.get_cwd()<EOL><DEDENT>else:<EOL><INDENT>path = None<EOL><DEDENT>def before_exec():<EOL><INDENT>"<STR_LIT>"<EOL>try:<EOL><INDENT>os.chdir(path or self.original_cwd)<EOL><DEDENT>except OSError:<EOL><INDENT>pass  <EOL><DEDENT>os.environ['<STR_LIT>'] = self.default_terminal<EOL>if self.socket_name:<EOL><INDENT>os.environ['<STR_LIT>'] = '<STR_LIT>' % (<EOL>self.socket_name, pane.pane_id)<EOL><DEDENT><DEDENT>if command:<EOL><INDENT>command = command.split()<EOL><DEDENT>else:<EOL><INDENT>command = [self.default_shell]<EOL><DEDENT>terminal = Terminal(done_callback=done_callback, bell_func=bell,<EOL>before_exec_func=before_exec)<EOL>pane = Pane(terminal)<EOL>self.panes_by_id[pane.pane_id] = pane<EOL>logger.info('<STR_LIT>', command)<EOL>return pane<EOL>
Create a new :class:`pymux.arrangement.Pane` instance. (Don't put it in
a window yet.)

:param window: If a window is given, take the CWD of the current
    process of that window as the start path for this pane.
:param command: If given, run this command instead of `self.default_shell`.
:param start_directory: If given, use this as the CWD.