code: def _record_msg_type(record: "pb.Record") -> str:
      msg_type = str(record.WhichOneof("record_type"))
      if msg_type == "request":
          request = record.request
          msg_type = str(request.WhichOneof("request_type"))
      return msg_type
  
imports: import datetime
  import logging
  import secrets
  import sys
  import threading
  from typing import TYPE_CHECKING, Optional, cast
label_desc: Use image node_id 2 for calling a global function with example usage: _record_msg_type(record) and returns: msg_type