def METHOD_NAME(
    args: CLIShellNamespace,
    parser: t.Optional[argparse.ArgumentParser] = None,
) -> None:
    """Launch python shell for tmux server, session, window and pane.
    Priority given to loaded session/window/pane objects:
    - session_name and window_name arguments
    - current shell: envvar ``TMUX_PANE`` for determining window and session
    - :attr:`libtmux.Server.attached_sessions`, :attr:`libtmux.Session.attached_window`,
      :attr:`libtmux.Window.attached_pane`
    """
    # If inside a server, detect socket_path
    env_tmux = os.getenv("TMUX")
    if env_tmux is not None and isinstance(env_tmux, str):
        env_socket_path = pathlib.Path(env_tmux.split(",")[0])
        if (
            env_socket_path.exists()
            and args.socket_path is None
            and args.socket_name is None
        ):
            args.socket_path = str(env_socket_path)
    server = Server(socket_name=args.socket_name, socket_path=args.socket_path)
    server.raise_if_dead()
    current_pane = util.get_current_pane(server=server)
    session = util.get_session(
        server=server, session_name=args.session_name, current_pane=current_pane
    )
    window = util.get_window(
        session=session, window_name=args.window_name, current_pane=current_pane
    )
    pane = util.get_pane(window=window, current_pane=current_pane)
    if args.command is not None:
        exec(args.command)
    else:
        if args.shell == "pdb" or (
            os.getenv("PYTHONBREAKPOINT") and PY3 and PYMINOR >= 7
        ):
            from tmuxp._compat import breakpoint as tmuxp_breakpoint
            tmuxp_breakpoint()
            return
        else:
            from ..shell import launch
            launch(
                shell=args.shell,
                use_pythonrc=args.use_pythonrc,  # shell: code
                use_vi_mode=args.use_vi_mode,  # shell: ptpython, ptipython
                # tmux environment / libtmux variables
                server=server,
                session=session,
                window=window,
                pane=pane,
            )