def make_limited_stream(stream, limit):
 if (not isinstance(stream, LimitedStream)):
  if (limit is None):
   raise TypeError('stream not limited and no limit provided.')
  stream = LimitedStream(stream, limit)
 return stream

def make_limited_stream ( stream , limit ) : if ( not isinstance ( stream , LimitedStream ) ) : if ( limit is None ) : raise TypeError ( 'stream not limited and no limit provided.' ) stream = LimitedStream ( stream , limit ) return stream
makes a stream limited .