def _split_map_maybe(function, sequence, marker=None):
 annotated = ((x, function(x)) for x in sequence)
 (original, mapped) = tee(annotated)
 return ((x for (x, y) in original if (y is marker)), (y for (x, y) in mapped if (y is not marker)))

def _split_map_maybe ( function , sequence , marker = None ) : annotated = ( ( x , function ( x ) ) for x in sequence ) ( original , mapped ) = tee ( annotated ) return ( ( x for ( x , y ) in original if ( y is marker ) ) , ( y for ( x , y ) in mapped if ( y is not marker ) ) )
lazily map function over sequence .