code: def generate_proto(source):
      """Invokes the Protocol Compiler to generate a _pb2.py from the given .proto file."""
  
      # Find the Protocol Compiler.
      if "PROTOC" in os.environ and os.path.exists(
          os.environ["PROTOC"]
      ):
          protoc = os.environ["PROTOC"]
      else:
          raise ValueError(
              'Environment variable "PROTOC" is not a correct path for protoc executable.'
          )
  
      output = source.replace(".proto", "_pb2.py")
      print("Generating %s..." % output)
  
      protoc_command = [protoc]
      if "PROTOC_PLUGINS" in os.environ and os.path.exists(
          os.environ["PROTOC_PLUGINS"]
      ):
          protoc_command += [
              "--plugin=" + os.environ["PROTOC_PLUGINS"],
              "--doc_out=docs/usage",
              "--doc_opt=docs/templates/proto.tmpl,proto_docgen.md",
          ]
      protoc_command += ["-I.", "--python_out=.", source]
      protoc_command = " ".join(protoc_command)
      print(protoc_command)
      if subprocess.call(protoc_command, shell=True) != 0:
          exit(-1)
  
file_path: autodist/setup.py
imports: import os
  import subprocess
  from setuptools import setup, find_packages
  from distutils.command.build_py import build_py
  from distutils.command.clean import clean
label_desc: Use image node_id 1 for calling a global function with example usage: generate_proto(source) without return types