def recursive_walk(function, data):
 if isinstance(data, list):
  return list((recursive_walk(function, val) for val in data))
 if isinstance(data, dict):
  return dict(((key, recursive_walk(function, val)) for (key, val) in data.iteritems()))
 return function(data)

def recursive_walk ( function , data ) : if isinstance ( data , list ) : return list ( ( recursive_walk ( function , val ) for val in data ) ) if isinstance ( data , dict ) : return dict ( ( ( key , recursive_walk ( function , val ) ) for ( key , val ) in data . iteritems ( ) ) ) return function ( data )
recursively go through a directory .