def rmap(fn, coll, is_iterable=None):
result = []<EOL>for x in coll:<EOL><INDENT>if is_iterable is None:<EOL><INDENT>is_iterable = isiterable<EOL><DEDENT>if is_iterable(x):<EOL><INDENT>y = rmap(fn, x)<EOL><DEDENT>else:<EOL><INDENT>y = fn(x)<EOL><DEDENT>result.append(y)<EOL><DEDENT>return result<EOL>
A recursive map

    :param fn: a function
    :param coll: a list
    :param isiterable: a predicate function determining whether a value is iterable.
    :returns: a list

    >>> rmap(lambda x: 2*x, [1, 2, [3, 4]])
    [2, 4, [6, 8]]