code: def build_color_scheme(
      color_scheme: t.Optional[foo.ColorScheme] = None,
      dataset: t.Optional[fod.Dataset] = None,
      app_config: t.Optional[AppConfig] = None,
  ) -> foo.ColorScheme:
      if color_scheme is None:
          if (
              dataset is not None
              and dataset.app_config.color_scheme is not None
          ):
              color_scheme = dataset.app_config.color_scheme.copy()
          else:
              color_scheme = foo.ColorScheme()
  
      if app_config is None:
          app_config = fo.app_config
  
      if not color_scheme.color_by:
          color_scheme.color_by = app_config.color_by
  
      if not color_scheme.color_pool:
          color_scheme.color_pool = app_config.color_pool
  
      if color_scheme.multicolor_keypoints is None:
          color_scheme.multicolor_keypoints = (
              app_config.multicolor_keypoints
          )
  
      if color_scheme.opacity is None:
          color_scheme.opacity = 0.7
  
      if color_scheme.show_skeletons is None:
          color_scheme.show_skeletons = app_config.show_skeletons
  
      return color_scheme
  
imports: import logging
  import typing
  from bson import json_util
  from dataclasses import asdict
  from mongoengine.base import BaseDict, BaseList
  import strawberry
  import eta.core.serial
  import eta.core.utils
  import fiftyone
  import fiftyone.core.clips
  from fiftyone.core.config import AppConfig
  import fiftyone.core.dataset
  from fiftyone.core.odm.dataset import ColorScheme
  import fiftyone.core.media
  import fiftyone.core.odm
  from fiftyone.core.spaces import Space
  import fiftyone.core.utils
  import fiftyone.core.view
  from fiftyone.server.scalars import JSON
label_desc: Use image node_id 3 for calling a global function with example usage: build_color_scheme(color_scheme, dataset, app_config) and returns: color_scheme