class_docstr: Writes a single pyi file
class_docstr_tok: ["Writes","a","single","pyi","file"]
docstr: Import a referenced message and return a handle
docstr_tok: ["Import","a","referenced","message","and","return","a","handle"]
code: def _import_message(self, name: str) -> str:
      """Import a referenced message and return a handle"""
      message_fd = self.descriptors.message_to_fd[name]
      assert message_fd.name.endswith(".proto")
  
      # Strip off package name
      if message_fd.package:
          assert name.startswith("." + message_fd.package + ".")
          name = name[len("." + message_fd.package + ".") :]
      else:
          assert name.startswith(".")
          name = name[1:]
  
      # Use prepended "_r_" to disambiguate message names that alias python reserved keywords
      split = name.split(".")
      for i, part in enumerate(split):
          if part in PYTHON_RESERVED:
              split[i] = "_r_" + part
      name = ".".join(split)
  
      # Message defined in this file. Note: GRPC stubs in same .proto are generated into separate files
      if not self.grpc and message_fd.name == self.fd.name:
          return (
              name
              if self.readable_stubs
              else _mangle_global_identifier(name)
          )
  
      # Not in file. Must import
      # Python generated code ignores proto packages, so the only relevant factor is
      # whether it is in the file or not.
      import_name = self._import(
          message_fd.name[:-6].replace("-", "_") + "_pb2", split[0]
      )
  
      remains = ".".join(split[1:])
      if not remains:
          return import_name
  
      # remains could either be a direct import of a nested enum or message
      # from another package.
      return import_name + "." + remains
  
imports: from __future__ import annotations
  import sys
  from collections import defaultdict
  from contextlib import contextmanager
  from typing import Any, Callable, Dict, Iterable, Iterator, List, Optional, Set, Sequence, Tuple
  import google.protobuf.descriptor_pb2
  from google.protobuf.compiler import plugin_pb2
  from google.protobuf.internal.containers import RepeatedCompositeFieldContainer
  from google.protobuf.internal.well_known_types import WKTBASES
  from .None import extensions_pb2
label_desc: Use image node_id 3 for calling the PkgWriter obj's underlying member method code with example usage: obj._import_message(name) and returns: unknown, unknown, import_name