<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _get_rest_doc(self, request, start_response):
 """Sends back HTTP response with API directory. This calls start_response and returns the response body. It will return the discovery doc for the requested api/version. Args: request: An ApiRequest, the transformed request sent to the Discovery API. start_response: A function with semantics defined in PEP-333. Returns: A string, the response body. """

    api = request.body_json['api']
    version = request.body_json['version']

    generator = discovery_generator.DiscoveryGenerator(request=request)
    services = [s for s in self._backend.api_services if
                s.api_info.name == api and s.api_info.api_version == version]
    doc = generator.pretty_print_config_to_json(services)
    if not doc:
      error_msg = ('Failed to convert .api to discovery doc for '
                   'version %s of api %s') % (version, api)
      _logger.error('%s', error_msg)
      return util.send_wsgi_error_response(error_msg, start_response)
    return self._send_success_response(doc, start_response)