def stop_dashboard(
    session: Optional[core_session.TruSession] = None, force: bool = False
) -> None:
    """
    Stop existing dashboard(s) if running.

    Args:
        force: Also try to find any other dashboard processes not
            started in this notebook and shut them down too.

            **This option is not supported under windows.**

    Raises:
            RuntimeError: Dashboard is not running in the current process. Can be avoided with `force`.
    """
    session = session or core_session.TruSession()
    if session._dashboard_proc is None:
        if not force:
            raise RuntimeError(
                "Dashboard not running in this session. "
                "You may be able to shut other instances by setting the `force` flag."
            )

        else:
            if sys.platform.startswith("win"):
                raise RuntimeError(
                    "Force stop option is not supported on windows."
                )

            print("Force stopping dashboard ...")
            import os
            import pwd  # PROBLEM: does not exist on windows

            import psutil

            username = pwd.getpwuid(os.getuid())[0]
            for p in psutil.process_iter():
                try:
                    cmd = " ".join(p.cmdline())
                    if (
                        "streamlit" in cmd
                        and "Leaderboard.py" in cmd
                        and p.username() == username
                    ):
                        print(f"killing {p}")
                        p.kill()
                except Exception:
                    continue

    else:
        session._dashboard_proc.kill()
        session._dashboard_proc = None

    Stop existing dashboard(s) if running.

    Args:
        force: Also try to find any other dashboard processes not
            started in this notebook and shut them down too.

            **This option is not supported under windows.**

    Raises:
            RuntimeError: Dashboard is not running in the current process. Can be avoided with `force`.
    
src/dashboard/trulens/dashboard/run.py