#NEWLINE# def get_document( request ) : #NEWLINE# #INDENT# 'Decodes document from prospective_search result POST request.\n\n  Args:\n    request: received POST request\n\n  Returns:\n    document: original NDB Model document from match call.\n\n  Raises:\n    DocumentTypeError: if document class is not recognized.\n  ' #NEWLINE# doc_class = request . get ( 'python_document_class' ) #NEWLINE# if ( not doc_class ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# entity = entity_pb . EntityProto ( ) #NEWLINE# entity . ParseFromString ( base64 . urlsafe_b64decode ( request . get ( 'document' ) . encode ( 'utf-8' ) ) ) #NEWLINE# doc_class = int ( doc_class ) #NEWLINE# ctx = tasklets . get_context ( ) #NEWLINE# adapter = ctx . _conn . adapter #NEWLINE# return adapter . pb_to_entity ( entity )