def map_recursive(function, iterable):
    """
    Apply function recursively to every item or value of iterable and returns a
    new iterable object with the results.
    """
    if isiterable(iterable):
        dataOut = iterable.__class__()
        for i in iterable:
            if isinstance(dataOut, dict):
                dataOut[i] = map_recursive(function, iterable[i])
            else:
                # convert to list and append
                if not isinstance(dataOut, list):
                    dataOut = list(dataOut)
                dataOut.append(map_recursive(function, i))
        return dataOut
    return function(iterable)
def map_recursive ( function , iterable ) : if isiterable ( iterable ) : dataOut = iterable . __class__ ( ) for i in iterable : if isinstance ( dataOut , dict ) : dataOut [ i ] = map_recursive ( function , iterable [ i ] ) else : if not isinstance ( dataOut , list ) : dataOut = list ( dataOut ) dataOut . append ( map_recursive ( function , i ) ) return dataOut return function ( iterable )
Apply function recursively to every item or value of iterable and returns a
    new iterable object with the results.