from typing import Callable


def optional_printer(is_stdout: bool) -> Callable[[str], None]:
    """
    Output printer -- acts as a printer if is_stdout is false, otherwise a no-op
    :param is_stdout:
    :return:
    """
    def _print(text: str) -> None:
        print(text)

    def _def_null(_: str) -> None:
        pass

    return _def_null if is_stdout else _print