def handle_backend_response(self, orig_request, backend_request,<EOL>response_status, response_headers,<EOL>response_body, method_config, start_response):
<EOL>for header, value in response_headers:<EOL><INDENT>if (header.lower() == '<STR_LIT>' and<EOL>not value.lower().startswith('<STR_LIT:application/json>')):<EOL><INDENT>return self.fail_request(orig_request,<EOL>'<STR_LIT>' % response_body,<EOL>start_response)<EOL><DEDENT><DEDENT>self.check_error_response(response_body, response_status)<EOL>empty_response = self.check_empty_response(orig_request, method_config,<EOL>start_response)<EOL>if empty_response is not None:<EOL><INDENT>return empty_response<EOL><DEDENT>body = self.transform_rest_response(response_body)<EOL>cors_handler = self._create_cors_handler(orig_request)<EOL>return util.send_wsgi_response(response_status, response_headers, body,<EOL>start_response, cors_handler=cors_handler)<EOL>
Handle backend response, transforming output as needed.

        This calls start_response and returns the response body.

        Args:
          orig_request: An ApiRequest, the original request from the user.
          backend_request: An ApiRequest, the transformed request that was
                           sent to the backend handler.
          response_status: A string, the status from the response.
          response_headers: A dict, the headers from the response.
          response_body: A string, the body of the response.
          method_config: A dict, the API config of the method to be called.
          start_response: A function with semantics defined in PEP-333.

        Returns:
          A string containing the response body.