def launch_external_file(filename: str, raise_if_fails: bool = False) -> None:
    """
    Launches a file using the operating system's standard launcher.

    Args:
        filename: file to launch
        raise_if_fails: raise any exceptions from
            ``subprocess.call(["xdg-open", filename])`` (Linux)
            or ``os.startfile(filename)`` (otherwise)? If not, exceptions
            are suppressed.

    """
    log.info("Launching external file: {!r}", filename)
    try:
        if sys.platform.startswith('linux'):
            cmdargs = ["xdg-open", filename]
            # log.debug("... command: {!r}", cmdargs)
            subprocess.call(cmdargs)
        else:
            # log.debug("... with os.startfile()")
            # noinspection PyUnresolvedReferences
            os.startfile(filename)
    except Exception as e:
        log.critical("Error launching {!r}: error was {}.\n\n{}",
                     filename, str(e), traceback.format_exc())
        if raise_if_fails:
            raise
Launches a file using the operating system's standard launcher.

    Args:
        filename: file to launch
        raise_if_fails: raise any exceptions from
            ``subprocess.call(["xdg-open", filename])`` (Linux)
            or ``os.startfile(filename)`` (otherwise)? If not, exceptions
            are suppressed.