#NEWLINE# @ extensionmethod ( Observable ) #NEWLINE# def last_or_default( self , predicate = None , default_value = None ) : #NEWLINE# #INDENT# 'Return last or default element.\n\n    Returns the last element of an observable sequence that satisfies\n    the condition in the predicate, or a default value if no such\n    element exists.\n\n    Examples:\n    res = source.last_or_default()\n    res = source.last_or_default(lambda x: x > 3)\n    res = source.last_or_default(lambda x: x > 3, 0)\n    res = source.last_or_default(None, 0)\n\n    predicate -- {Function} [Optional] A predicate function to evaluate\n        for elements in the source sequence.\n    default_value -- [Optional] The default value if no such element\n        exists. If not specified, defaults to None.\n\n    Returns {Observable} Sequence containing the last element in the\n    observable sequence that satisfies the condition in the predicate,\n    or a default value if no such element exists.\n    ' #NEWLINE# if predicate : #NEWLINE# #INDENT# return self . filter ( predicate ) . last_or_default ( None , default_value ) #NEWLINE# #UNINDENT# return last_or_default_async ( self , True , default_value )