def METHOD_NAME():
    sys.stdout = open(
        sys.stdout.fileno(), "w", encoding="utf8", errors="surrogateescape"
    )
    sys.stderr = open(
        sys.stderr.fileno(), "w", encoding="utf8", errors="surrogateescape"
    )
    starttime = None
    since = 0.0
    args = parse_args()
    if args.jobids and args.filtered:
        LOGGER.warning("Filtering options ignored with jobid list")
    fh = flux.Flux()
    instance_starttime = float(fh.attr_get("broker.starttime"))
    if args.since:
        #  Implies --all unless any other filter option is already in effect.
        if not args.filter:
            args.all = True
        try:
            since = flux.util.parse_datetime(args.since).timestamp()
        except ValueError:
            try:
                since = float(args.since)
            except ValueError:
                LOGGER.error(f"--since: invalid value '{args.since}'")
                sys.exit(2)
        # Ensure args.since is in the past
        if since > flux.util.parse_datetime("now").timestamp():
            LOGGER.error("--since=%s appears to be in the future", args.since)
            sys.exit(2)
        #  With since, start elapsed timer at maximum of since time or
        #  instance starttime
        starttime = max(since, instance_starttime)
    if args.active:
        args.filter.update(("pending", "running"))
    if args.all:
        args.filter.update(("pending", "running", "inactive"))
        if not starttime:
            starttime = instance_starttime
    if not args.filter and not args.jobids:
        LOGGER.error("At least one job selection option is required")
        print("Try 'flux watch --help' for more information.", file=sys.stderr)
        sys.exit(1)
    joblist = JobList(
        fh,
        ids=args.jobids,
        attrs=["state", "result", "t_submit"],
        filters=args.filter,
        since=since,
        user=str(os.getuid()),
        max_entries=args.count,
    )
    jobs = list(joblist.jobs())
    for errmsg in joblist.errors:
        LOGGER.error(errmsg)
    if not jobs:
        LOGGER.info("No matching jobs")
        sys.exit(0)
    if args.verbose:
        LOGGER.info(f"Watching {len(jobs)} jobs")
    if args.progress and not sys.stdout.isatty():
        LOGGER.warning("stdout is not a tty. Ignoring --progress option")
        args.progress = False
    watcher = JobWatcher(
        fh,
        jobs=jobs,
        progress=args.progress,
        jps=args.jps,
        log_events=(args.verbose > 1),
        log_status=(args.verbose > 0),
        labelio=args.label_io,
        starttime=starttime,
    ).start()
    fh.reactor_run()
    sys.exit(watcher.exitcode)