def applyFunctionRecursively(value, function):
 if isListLike(value):
  retVal = [applyFunctionRecursively(_, function) for _ in value]
 else:
  retVal = function(value)
 return retVal

def applyFunctionRecursively ( value , function ) : if isListLike ( value ) : retVal = [ applyFunctionRecursively ( _ , function ) for _ in value ] else : retVal = function ( value ) return retVal
applies function recursively through list-like structures .