code: def validate_proto_fields(
      field: str | None, io_: IODescriptor[t.Any]
  ) -> str | ProtoField:
      if field is None:
          raise InvalidArgument('"field" cannot be empty.')
      accepted_fields = io_.proto_fields + ("serialized_bytes",)
      if field not in accepted_fields:
          raise InvalidArgument(
              f"'{io_.__class__.__name__}' accepts one of the following fields: '{','.join(accepted_fields)}' got '{field}' instead.",
          ) from None
      return field
  
imports: from __future__ import annotations
  import logging
  import typing
  from dataclasses import dataclass
  from functools import lru_cache
  from http import HTTPStatus
  from typing import TYPE_CHECKING
  from ..._internal.utils import resolve_user_filepath
  from ...exceptions import InvalidArgument
  from ._import_hook import LATEST_PROTOCOL_VERSION
  from ._import_hook import import_generated_stubs
  from ._import_hook import import_grpc
label_desc: Use image node_id 2 for calling a global function with example usage: validate_proto_fields(field, io_) and returns: field