def removeDynamicContent(page):
 if page:
  for item in kb.dynamicMarkings:
   (prefix, suffix) = item
   if ((prefix is None) and (suffix is None)):
    continue
   elif (prefix is None):
    page = re.sub(('(?s)^.+%s' % re.escape(suffix)), suffix.replace('\\', '\\\\'), page)
   elif (suffix is None):
    page = re.sub(('(?s)%s.+$' % re.escape(prefix)), prefix.replace('\\', '\\\\'), page)
   else:
    page = re.sub(('(?s)%s.+%s' % (re.escape(prefix), re.escape(suffix))), ('%s%s' % (prefix.replace('\\', '\\\\'), suffix.replace('\\', '\\\\'))), page)
 return page

def removeDynamicContent ( page ) : if page : for item in kb . dynamicMarkings : ( prefix , suffix ) = item if ( ( prefix is None ) and ( suffix is None ) ) : continue elif ( prefix is None ) : page = re . sub ( ( '(?s)^.+%s' % re . escape ( suffix ) ) , suffix . replace ( '\\' , '\\\\' ) , page ) elif ( suffix is None ) : page = re . sub ( ( '(?s)%s.+$' % re . escape ( prefix ) ) , prefix . replace ( '\\' , '\\\\' ) , page ) else : page = re . sub ( ( '(?s)%s.+%s' % ( re . escape ( prefix ) , re . escape ( suffix ) ) ) , ( '%s%s' % ( prefix . replace ( '\\' , '\\\\' ) , suffix . replace ( '\\' , '\\\\' ) ) ) , page ) return page
removing dynamic content from supplied page basing removal on precalculated dynamic markings .