code: def get_doc_id(document_pb, expected_prefix):
      
      prefix, document_id = document_pb.name.rsplit(DOCUMENT_PATH_DELIMITER, 1)
      if prefix != expected_prefix:
          raise ValueError(
              "Unexpected document name",
              document_pb.name,
              "Expected to begin with",
              expected_prefix,
          )
  
      return document_id
docs: Parse a document ID from a document protobuf.
  
      Args:
          document_pb (google.cloud.proto.firestore.v1beta1.\
              document_pb2.Document): A protobuf for a document that
              was created in a ``CreateDocument`` RPC.
          expected_prefix (str): The expected collection prefix for the
              fully-qualified document name.
  
      Returns:
          str: The document ID from the protobuf.
  
      Raises:
          ValueError: If the name does not begin with the prefix.