code: def validate_field_name(
      field_name, media_type=None, is_frame_field=False
  ):
      """Verifies that the given field name is valid.
  
      Args:
          field_name: the field name
          media_type (None): the media type of the sample, if known
          is_frame_field (False): whether this is a frame-level field
  
      Raises:
          ValueError: if the field name is invalid
      """
      if not isinstance(field_name, str):
          raise ValueError(
              "Invalid field name '%s'. Field names must be strings; found "
              "%s" % (field_name, type(field_name))
          )
  
      chunks = field_name.split(".")
  
      if not all(c for c in chunks):
          raise ValueError(
              "Invalid field name '%s'. Field names cannot be empty"
              % field_name
          )
  
      if any(c.startswith("_") for c in chunks):
          raise ValueError(
              "Invalid field name: '%s'. Field names cannot start with '_'"
              % field_name
          )
  
      if "$" in field_name:
          raise ValueError(
              "Invalid field name: '%s'. Field names cannot contain '$'"
              % field_name
          )
  
      if (
          media_type == fom.VIDEO
          and not is_frame_field
          and field_name == "frames"
      ):
          raise ValueError(
              "Invalid field name '%s'. 'frames' is a reserved keyword for "
              "video datasets" % field_name
          )
  
      if (
          media_type == fom.GROUP
          and not is_frame_field
          and field_name == "groups"
      ):
          raise ValueError(
              "Invalid field name '%s'. 'groups' is a reserved keyword for "
              "grouped datasets" % field_name
          )
  
imports: from datetime import date, datetime
  import inspect
  import json
  import numbers
  import six
  import sys
  from bson import Binary, json_util, ObjectId, SON
  import numpy
  import pytz
  import fiftyone
  import fiftyone.core.fields
  import fiftyone.core.media
  import fiftyone.core.utils
label_desc: Use image node_id 3 for calling a global function with example usage: validate_field_name(field_name, media_type, is_frame_field) without return types