docs: def MakeProto():
    """Make sure our protos have been compiled to python libraries."""
    # Start running from one directory above the grr directory which is found by
    # this scripts's location as __file__.
    cwd = os.path.dirname(os.path.abspath(__file__))
  
    # Find all the .proto files.
    protos_to_compile = []
    for (root, _, files) in os.walk(cwd):
      for filename in files:
        full_filename = os.path.join(root, filename)
        if full_filename.endswith(".proto"):
          proto_stat = os.stat(full_filename)
  
          pb2_path = full_filename.rsplit(".", 1)[0] + "_pb2.py"
          try:
            pb2_stat = os.stat(pb2_path)
            if pb2_stat.st_mtime >= proto_stat.st_mtime:
              continue
  
          except (OSError, IOError):
            pass
  
          protos_to_compile.append(full_filename)
  
    if protos_to_compile:
      # Find the protoc compiler.
      protoc = os.environ.get("PROTOC", "protoc")
      try:
        output = subprocess.check_output([protoc, "--version"])
      except (IOError, OSError):
        raise RuntimeError("Unable to launch %s protoc compiler. Please "
                           "set the PROTOC environment variable.", protoc)
  
      if b"3.6.1" not in output:
        raise RuntimeError("Incompatible protoc compiler detected. "
                           "We need 3.6.1 not %s" % output)
  
      for proto in protos_to_compile:
        command = [
            protoc,
            # Write the python files next to the .proto files.
            "--python_out",
            ROOT,
            "--proto_path=%s" % ROOT,
            proto
        ]
        print(
            "Compiling %s with (cwd: %s): %s" % (proto, ROOT, " ".join(command)))
        # The protoc compiler is too dumb to deal with full paths - it expects a
        # relative path from the current working directory.
        subprocess.check_call(command, cwd=ROOT)