#NEWLINE# def _Dynamic_GetHostname( self , request , response , request_id ) : #NEWLINE# #INDENT# if request . has_instance ( ) : #NEWLINE# #INDENT# instance = request . instance ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# instance = None #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# ( module , version , dispatcher ) = self . _GetModuleAndVersionFromRequest ( request , request_id ) #NEWLINE# response . set_hostname ( dispatcher . get_hostname ( module , version , instance ) ) #NEWLINE# #UNINDENT# except ( request_info . ModuleDoesNotExistError , request_info . VersionDoesNotExistError ) : #NEWLINE# #INDENT# raise apiproxy_errors . ApplicationError ( modules_service_pb . ModulesServiceError . INVALID_MODULE ) #NEWLINE# #UNINDENT# except request_info . InvalidInstanceIdError : #NEWLINE# #INDENT# raise apiproxy_errors . ApplicationError ( modules_service_pb . ModulesServiceError . INVALID_INSTANCES )