#NEWLINE# def first_or_default_async( source , has_default = False , default_value = None ) : #NEWLINE# #INDENT# def subscribe( observer ) : #NEWLINE# #INDENT# def on_next( x ) : #NEWLINE# #INDENT# observer . on_next ( x ) #NEWLINE# observer . on_completed ( ) #NEWLINE# #UNINDENT# def on_completed( ) : #NEWLINE# #INDENT# if ( not has_default ) : #NEWLINE# #INDENT# observer . on_error ( SequenceContainsNoElementsError ( ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# observer . on_next ( default_value ) #NEWLINE# observer . on_completed ( ) #NEWLINE# #UNINDENT# #UNINDENT# return source . subscribe ( on_next , observer . on_error , on_completed ) #NEWLINE# #UNINDENT# return AnonymousObservable ( subscribe )