code: def _get_source_feature_domains(
      schema_or_domain: Union[
          schema_pb2.Schema, schema_pb2.StructDomain
      ],
      string_domains: Dict[str, schema_pb2.StringDomain],
  ) -> Dict[str, common_types.DomainType]:
      """Recursively extracts domains of all source features in the schema."""
      result = {}
      for feature in schema_or_domain.feature:
          domain_info = feature.WhichOneof("domain_info")
          if domain_info == "struct_domain":
              result.update(
                  _get_source_feature_domains(
                      feature.struct_domain, string_domains
                  )
              )
          else:
              domain = _get_domain(feature, string_domains)
              if domain is not None:
                  result[feature.name] = domain
      return result
  
imports: import dataclasses
  import typing
  from typing import Dict, List, Mapping, Optional, Tuple, Union
  import tensorflow
  from tensorflow_transform import common_types
  from tensorflow_transform.tf_metadata import schema_utils_legacy
  from tfx_bsl.tfxio import tensor_representation_util
  from tensorflow_metadata.proto.v0 import path_pb2
  from tensorflow_metadata.proto.v0 import schema_pb2
label_desc: Use image node_id 10 for calling a global function with example usage: _get_source_feature_domains(schema_or_domain, string_domains) and returns: result