<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _GenOpenApiSpec(service_class_names, output_path, hostname=None, application_path=None, x_google_api_name=False):
 """Write openapi documents generated from the service classes to file. Args: service_class_names: A list of fully qualified ProtoRPC service names. output_path: The directory to which to output the OpenAPI specs. hostname: A string hostname which will be used as the default version hostname. If no hostname is specified in the @endpoints.api decorator, this value is the fallback. Defaults to None. application_path: A string containing the path to the AppEngine app. Returns: A list of OpenAPI spec filenames. """

  output_files = []
  service_configs = GenApiConfig(
      service_class_names, hostname=hostname,
      config_string_generator=openapi_generator.OpenApiGenerator(),
      application_path=application_path,
      x_google_api_name=x_google_api_name)
  for api_name_version, config in service_configs.iteritems():
    openapi_name = api_name_version.replace('-', '') + 'openapi.json'
    output_files.append(_WriteFile(output_path, openapi_name, config))

  return output_files