def polinfo(args):
    """Print policy information"""
    # 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)
    # Begin initialisation
    try:
        if not args.policy:
            # If we have no policy, use a device
            device = get_device(args.device, args.adb)
            # Workaround, make sure we propagate the device name
            if not args.device:
                args.device = device.name
            p = Policy(device)
        else:
            # Use the provided policy
            p = Policy(None, args.policy)
    except (ValueError, __HOLE__):
        logging.critical("You need to provide either a valid policy "
                         "or a running Android device.")
        sys.exit(1)
    # End initialisation

    if not args.policy:
        print "Device {} is running Android {} with SELinux in {} mode.".format(
            device, device.android_version, device.selinux_mode)

    if args.info_domains:
        print "The policy contains {} domains:".format(p.domains_count)
        for dom in p.domains.keys():
            print dom
    else:
        print "Classes:\t\t{}".format(p.classes_count)
        print "Types:\t\t\t{}".format(p.types_count)
        print "Attributes:\t\t{}".format(p.attrs_count)
        print "Domains:\t\t{}".format(p.domains_count)
        print "Initial SIDs:\t\t{}".format(p.policy.initialsids_count)
        print "Capabilities:\t\t{}".format(p.policy.polcap_count)
        print "Roles:\t\t\t{}".format(p.policy.role_count)
        print "Users:\t\t\t{}".format(p.policy.user_count)
        print "Fs_uses:\t\t{}".format(p.policy.fs_use_count)
        print "Genfscons:\t\t{}".format(p.policy.genfscon_count)
        print "Portcons:\t\t{}".format(p.policy.portcon_count)
        print "MLS sensitivities:\t{}".format(p.policy.level_count)
        print "MLS categories:\t\t{}".format(p.policy.category_count)
        print "MLS constraints:\t{}".format(p.policy.constraint_count)
        print "Permissive types:\t{}".format(p.policy.permissives_count)

        print "Allow rules:\t\t{}".format(p.policy.allow_count)
        print "Auditallow rules:\t{}".format(p.policy.auditallow_count)
        print "Dontaudit rules:\t{}".format(p.policy.dontaudit_count)
        print "Type_trans rules:\t{}".format(p.policy.type_transition_count)
        print "Type_change rules:\t{}".format(p.policy.type_change_count)
        print "Type_member rules:\t{}".format(p.policy.type_member_count)
        print "Role_allow rules:\t{}".format(p.policy.role_allow_count)
        print "Role_trans rules:\t{}".format(p.policy.role_transition_count)
        print "Range_trans rules:\t{}".format(p.policy.range_transition_count)
dataset/ETHPy150Open seandroid-analytics/seal/seal.py/polinfo