def protorpc_to_endpoints_error(self, status, body):
try:<EOL><INDENT>rpc_error = self.__PROTOJSON.decode_message(remote.RpcStatus, body)<EOL><DEDENT>except (ValueError, messages.ValidationError):<EOL><INDENT>rpc_error = remote.RpcStatus()<EOL><DEDENT>if rpc_error.state == remote.RpcStatus.State.APPLICATION_ERROR:<EOL><INDENT>error_class = _ERROR_NAME_MAP.get(rpc_error.error_name)<EOL>if error_class:<EOL><INDENT>status, body = self.__write_error(error_class.http_status,<EOL>rpc_error.error_message)<EOL><DEDENT><DEDENT>return status, body<EOL>
Convert a ProtoRPC error to the format expected by Google Endpoints.

        If the body does not contain an ProtoRPC message in state APPLICATION_ERROR
        the status and body will be returned unchanged.

        Args:
          status: HTTP status of the response from the backend
          body: JSON-encoded error in format expected by Endpoints frontend.

        Returns:
          Tuple of (http status, body)