@staticmethod
    def __check_root_adb(device, adb):
        cmd = [adb, "-s", device]
        # Initially assume we are not root
        root_adb = "not_root"
        # Try running adb as root
        root_status = subprocess.check_output(cmd + ["root"]).strip('\r\n')
        if (root_status == "adbd is already running as root" or
                root_status == "restarting adbd as root"):
            # We have root
            root_adb = "root_adb"
        else:
            # Check wether 'su' exists
            root_status = subprocess.check_output(
                cmd + ["shell", "command", "-v", "su"]).strip('\r\n')
            # If su exists, check if we can be root
            if root_status:
                root_status = subprocess.check_output(
                    cmd + ["shell", "su", "-c", "id"]).strip('\r\n')
                if "uid=0(root) gid=0(root)" in root_status:
                    # We have a root shell
                    root_adb = "root_shell"
        # Return our level of root
        return root_adb
Iterates over all items below a path and yields them as
dataset/ETHPy150Open seandroid-analytics/seal/sealib/device.py/Device.__check_root_adb--crossover with--dataset/ETHPy150Open lektor/lektor/lektor/db.py/Database.iter_items