def processes(args):
    """List processes on a device, with the option to filter them by a file
    they can access."""
    # Setup logging
    if args.verbosity == 4:
        logging.basicConfig(level=logging.DEBUG)
    elif args.verbosity == 3:
        logging.basicConfig(level=logging.INFO)
    elif args.verbosity == 2:
        logging.basicConfig(level=logging.WARNING)
    elif args.verbosity == 1:
        logging.basicConfig(level=logging.ERROR)
    elif args.verbosity == 0:
        logging.basicConfig(level=logging.CRITICAL)
    # Start initialization
    # Create the device
    try:
        device = get_device(args.device, args.adb)
    except (ValueError, RuntimeError):
        sys.exit(1)
    # Workaround, make sure we propagate the device name
    if not args.device:
        args.device = device.name
    # End initialization

    processes_dict = device.get_processes()
    if not args.file and not args.path:
        # Just list all the processes
        print_processes(args, None, processes_dict, None)
    else:
        # Create the policy
        try:
            p = Policy(device)
        except (ValueError, __HOLE__):
            logging.critical("You need to provide a running Android device.")
            sys.exit(1)
        # Filter the processes by file
        if args.file:
            files_dict = device.get_file(args.file)
            if files_dict is None:
                logging.critical(
                    "There is no file \"%s\" on the device.", args.file)
                sys.exit(1)
        else:
            files_dict = device.get_files(args.path)
            if files_dict is None:
                logging.critical(
                    "There is no folder \"%s\" on the device.", args.file)
                sys.exit(1)
        proc_permissions = get_file_permissions(p, files_dict,
                                                processes_dict)
        print_processes(args, files_dict, processes_dict, proc_permissions)
dataset/ETHPy150Open seandroid-analytics/seal/seal.py/processes