code: def _validate_geojson(geojson_document):
      try:
          geojson_instance = geojson.loads(json.dumps(geojson_document))
      except ValueError as e:
          raise InvalidGeoJson(e.message)
      if not isinstance(geojson_instance, geojson.GeoJSON):
          # Sometimes GeoJSON.to_instance fails silently and just returns
          # the original type, rather than validation errors.
          # Try with, e.g. an empty dictionary.
          raise InvalidGeoJson("Could not convert document to GeoJSON.")
      if not geojson_instance.is_valid:
          raise InvalidGeoJson(", ".join(geojson_instance.errors()))
      if geojson_document["type"] != "FeatureCollection":
          raise InvalidGeoJson(
              "Only FeatureCollection GeoJSON is currently supported"
          )
  
imports: import json
  import copy
  import ipywidgets
  from traitlets import Unicode, Dict, List, observe, Float
  import geojson
  from .None import geotraitlets
  from .None import bounds
  from .options import merge_option_dicts, broadcast_if_atomic, broadcast_if_color_atomic
  from .maps import GMapsWidgetMixin
label_desc: Use image node_id 3 for calling a global function with example usage: _validate_geojson(geojson_document) without return types