def _check_for_script(data):
    for key, value in data.items():
        if value:
            if isinstance(value, dict):
                if _check_for_script(value):
                    return True
            elif isinstance(value, list):
                for x in value:
                    if _check_for_script(x):
                        return True
            elif isinstance(value, str):
                if "<script>" in value:
                    return True
    return False

@@ -232,12 +232,11 @@
 ue, 
-li
 st
+r
 ):%0A 
@@ -254,73 +254,32 @@
     
-for x in value:%0A                    if _check_for_script(x):%0A    
+if %22%3Cscript%3E%22 in value:%0A
     
@@ -333,35 +333,36 @@
 instance(value, 
+li
 st
-r
 ):%0A             
@@ -368,32 +368,73 @@
     
-if %22%3Cscript%3E%22 in value:%0A
+for x in value:%0A                    if _check_for_script(x):%0A    
     

change if order to leave for-now-unused case at the end