#NEWLINE# def subscribe( self , on_next = None , on_error = None , on_completed = None , observer = None ) : #NEWLINE# #INDENT# 'Subscribes an observer to the observable sequence. Returns the\n        source sequence whose subscriptions and unsubscriptions happen on the\n        specified scheduler.\n\n        1 - source.subscribe()\n        2 - source.subscribe(observer)\n        3 - source.subscribe(on_next)\n        4 - source.subscribe(on_next, on_error)\n        5 - source.subscribe(on_next, on_error, on_completed)\n\n        Keyword arguments:\n        on_next -- [Optional] Action to invoke for each element in the\n            observable sequence.\n        on_error -- [Optional] Action to invoke upon exceptional termination of\n            the observable sequence.\n        on_completed -- [Optional] Action to invoke upon graceful termination\n            of the observable sequence.\n        observer -- [Optional] The object that is to receive notifications. You\n            may subscribe using an observer or callbacks, not both.\n\n        Returns {Diposable} the source sequence whose subscriptions and\n        unsubscriptions happen on the specified scheduler.' #NEWLINE# if isinstance ( on_next , AbstractObserver ) : #NEWLINE# #INDENT# observer = on_next #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( not observer ) : #NEWLINE# #INDENT# observer = Observer ( on_next , on_completed , on_completed ) #NEWLINE# #UNINDENT# #UNINDENT# return self . _subscribe ( observer )