def _GenClientLib(discovery_path, language, output_path, build_system):
with open(discovery_path) as f:<EOL><INDENT>discovery_doc = f.read()<EOL><DEDENT>client_name = re.sub(r'<STR_LIT>', '<STR_LIT>',<EOL>os.path.basename(discovery_path))<EOL>return _GenClientLibFromContents(discovery_doc, language, output_path,<EOL>build_system, client_name)<EOL>
Write a client library from a discovery doc.

    Args:
      discovery_path: Path to the discovery doc used to generate the client
        library.
      language: The client library language to generate. (java)
      output_path: The directory to output the client library zip to.
      build_system: The target build system for the client library language.

    Raises:
      IOError: If reading the discovery doc fails.
      ServerRequestException: If fetching the generated client library fails.

    Returns:
      The path to the zipped client library.