#NEWLINE# def first( self ) : #NEWLINE# #INDENT# '\n        Returns the first object of a query, returns None if no match is found.\n        ' #NEWLINE# qs = ( self if qs . ordered else self . order_by ( 'pk' ) ) #NEWLINE# try : #NEWLINE# #INDENT# return qs [ 0 ] #NEWLINE# #UNINDENT# except IndexError : #NEWLINE# #INDENT# return None