def process_picker(args, proclist):
    """Pick a process according to the command line arguments."""
    candidate = None
    # Match by PID
    if args.pid and args.pid in proclist:
        candidate = proclist[args.pid]
    # Match by exact name
    elif args.process:
        for proc in proclist.values():
            if proc.name == args.process:
                candidate = proc
                break
    # If we haven't matched the PID or exact name, match the partial name
    if candidate is None:
        for proc in proclist.values():
            if args.process in proc.name:
                candidate = proc
                break
    return candidate
dataset/ETHPy150Open seandroid-analytics/seal/seal.py/process_picker/original