def verify_binary(flag_name, process_args=None):
    """Exits the program if the binary from the given flag doesn't run.

    Args:
        flag_name: Name of the flag that should be the path to the binary.
        process_args: Args to pass to the binary to do nothing but verify
            that it's working correctly (something like "--version") is good.
            Optional. Defaults to no args.

    Raises:
        SystemExit with error if the process did not work.
    """
    if process_args is None:
        process_args = []

    path = getattr(FLAGS, flag_name)
    if not path:
        logging.error('Flag %r not set' % flag_name)
        sys.exit(1)

    with open(os.devnull, 'w') as dev_null:
        try:
            subprocess.check_call(
                [path] + process_args,
                stdout=dev_null,
                stderr=subprocess.STDOUT)
        except:
            logging.exception('--%s binary at path %r does not work',
                              flag_name, path)
            sys.exit(1)
dataset/ETHPy150Open bslatkin/dpxdt/dpxdt/client/utils.py/verify_binary/original