def METHOD_NAME(
    args: CLIFreezeNamespace,
    parser: t.Optional[argparse.ArgumentParser] = None,
) -> None:
    """Snapshot a tmux session into a tmuxp workspace.
    If SESSION_NAME is provided, snapshot that session. Otherwise, use the
    current session."""
    server = Server(socket_name=args.socket_name, socket_path=args.socket_path)
    try:
        if args.session_name:
            session = server.sessions.get(session_name=args.session_name, default=None)
        else:
            session = util.get_session(server)
        if not session:
            raise exc.SessionNotFound()
    except TmuxpException as e:
        print(e)
        return
    frozen_workspace = freezer.freeze(session)
    workspace = freezer.inline(frozen_workspace)
    configparser = ConfigReader(workspace)
    if not args.quiet:
        print(
            "---------------------------------------------------------------"
            "\n"
            "Freeze does its best to snapshot live tmux sessions.\n"
        )
    if not (
        args.answer_yes
        or prompt_yes_no(
            "The new workspace will require adjusting afterwards. Save workspace file?"
        )
    ):
        if not args.quiet:
            print(
                "tmuxp has examples in JSON and YAML format at "
                "<http://tmuxp.git-pull.com/examples.html>\n"
                "View tmuxp docs at <http://tmuxp.git-pull.com/>."
            )
        sys.exit()
    dest = args.save_to
    while not dest:
        save_to = os.path.abspath(
            os.path.join(
                get_workspace_dir(),
                "{}.{}".format(
                    frozen_workspace.get("session_name"),
                    args.workspace_format or "yaml",
                ),
            )
        )
        dest_prompt = prompt(
            "Save to: %s" % save_to,
            default=save_to,
        )
        if not args.force and os.path.exists(dest_prompt):
            print("%s exists. Pick a new filename." % dest_prompt)
            continue
        dest = dest_prompt
    dest = os.path.abspath(os.path.relpath(os.path.expanduser(dest)))
    workspace_format = args.workspace_format
    valid_workspace_formats: t.List["CLIOutputFormatLiteral"] = ["json", "yaml"]
    def is_valid_ext(stem: t.Optional[str]) -> "TypeGuard[CLIOutputFormatLiteral]":
        return stem in valid_workspace_formats
    if not is_valid_ext(workspace_format):
        def extract_workspace_format(
            val: str,
        ) -> t.Optional["CLIOutputFormatLiteral"]:
            suffix = pathlib.Path(val).suffix
            if isinstance(suffix, str):
                suffix = suffix.lower().lstrip(".")
                if is_valid_ext(suffix):
                    return suffix
            return None
        workspace_format = extract_workspace_format(dest)
        if not is_valid_ext(workspace_format):
            workspace_format = prompt_choices(
                "Couldn't ascertain one of [%s] from file name. Convert to"
                % ", ".join(valid_workspace_formats),
                choices=valid_workspace_formats,
                default="yaml",
            )
    if workspace_format == "yaml":
        workspace = configparser.dump(
            format="yaml", indent=2, default_flow_style=False, safe=True
        )
    elif workspace_format == "json":
        workspace = configparser.dump(format="json", indent=2)
    if args.answer_yes or prompt_yes_no("Save to %s?" % dest):
        destdir = os.path.dirname(dest)
        if not os.path.isdir(destdir):
            os.makedirs(destdir)
        with open(dest, "w") as buf:
            buf.write(workspace)
        if not args.quiet:
            print("Saved to %s." % dest)