code: def is_protobuf_timestamp(ts: str) -> bool:
      """Validates that a string timestamp is in a Protobuf-compatible format.
  
      Protobuf requires timestamps in a limited RFC3339 format which requires a trailing "Z" to
      indicate UTC timezone.
  
      Arguments:
          ts (string): timestamp string (eg. ``yyyy-MM-dd'T'HH:mm:ss'Z'``)
      """
      if not ts.endswith("Z"):
          return False
  
      # Protobuf accepts timestamps with or without microseconds.
      accepted_formats = ["%Y-%m-%dT%H:%M:%S.%fZ", "%Y-%m-%dT%H:%M:%SZ"]
      for fmt in accepted_formats:
          try:
              datetime.datetime.strptime(ts, fmt)
          except (ValueError, TypeError):
              continue
          else:
              # Return if any format is successful.
              return True
      return False
  
imports: import datetime
  import functools
  import io
  import json
  import os
  import pathlib
  import platform
  import random
  import re
  import sys
  import time
  import warnings
  from typing import IO, Any, Callable, Dict, Iterator, Optional, Sequence, Tuple, TypeVar, Union, cast, no_type_check, overload
  import urllib3
  from determined.common import yaml
label_desc: Use image node_id 18 for calling a global function with example usage: is_protobuf_timestamp(ts) and returns: False, False, True