def _do_for_subarray(entry, condition, func, path=None):
 if (path is None):
  path = []
 if isinstance(entry, list):
  if condition(entry):
   func(entry, path)
  else:
   for (index, item) in enumerate(entry):
    _do_for_subarray(item, condition, func, (path + [index]))

def _do_for_subarray ( entry , condition , func , path = None ) : if ( path is None ) : path = [ ] if isinstance ( entry , list ) : if condition ( entry ) : func ( entry , path ) else : for ( index , item ) in enumerate ( entry ) : _do_for_subarray ( item , condition , func , ( path + [ index ] ) )
executes a function for a subarray of a nested array if it matches the given condition .