#NEWLINE# def nested_serialize( self , rel ) : #NEWLINE# #INDENT# if hasattr ( rel , 'Elasticsearch' ) : #NEWLINE# #INDENT# serializer = rel . es . get_serializer ( max_depth = self . max_depth , cur_depth = ( self . cur_depth + 1 ) ) #NEWLINE# obj = serializer . format ( rel ) #NEWLINE# return obj #NEWLINE# #UNINDENT# return dict ( id = rel . pk , value = unicode ( rel ) )