#NEWLINE# @ extensionmethod ( Observable ) #NEWLINE# def to_iterable( self ) : #NEWLINE# #INDENT# 'Creates an iterable from an observable sequence.\n\n    :returns: An observable sequence containing a single element with a list\n    containing all the elements of the source sequence.\n    :rtype: Observable\n    ' #NEWLINE# source = subscribe #NEWLINE# def subscribe( observer ) : #NEWLINE# #INDENT# queue = [ ] #NEWLINE# def on_next( item ) : #NEWLINE# #INDENT# queue . append ( item ) #NEWLINE# #UNINDENT# def on_completed( ) : #NEWLINE# #INDENT# observer . on_next ( queue ) #NEWLINE# observer . on_completed ( ) #NEWLINE# #UNINDENT# return source . subscribe ( on_next , observer . on_error , on_completed ) #NEWLINE# #UNINDENT# return AnonymousObservable ( subscribe )