#NEWLINE# @ extensionmethod ( BlockingObservable , alias = 'to_string' ) #NEWLINE# def to_marbles( self , scheduler = None ) : #NEWLINE# #INDENT# 'Convert an observable sequence into a marble diagram string\n\n    Keyword arguments:\n    scheduler -- [Optional] The scheduler used to run the the input\n        sequence on.\n\n    Returns marble string.\n    ' #NEWLINE# latch = threading . Event ( ) #NEWLINE# ret = [ None ] #NEWLINE# def on_next( value ) : #NEWLINE# #INDENT# ret [ 0 ] = value #NEWLINE# #UNINDENT# self . observable . to_marbles ( scheduler = scheduler ) . subscribe ( on_next , on_completed = latch . set ) #NEWLINE# latch . wait ( ) #NEWLINE# return ret [ 0 ]