code: def generate_pydantic_schema_for_metadata(
      metadata_properties: List[
          Union[
              "AllowedMetadataPropertyTypes",
              "AllowedRemoteMetadataPropertyTypes",
          ]
      ],
      name: Optional[str] = "MetadataSchema",
      allow_extra_metadata: bool = True,
  ) -> Type[BaseModel]:
      """Generates a `pydantic.BaseModel` schema from a list of `AllowedMetadataPropertyTypes` or
      `AllowedRemoteMetadataPropertyTypes` objects to validate the metadata of a `FeedbackDataset`
      or `RemoteFeedbackDataset` object, respectively, before inserting them.
  
      Args:
          metadata_properties: the list of `AllowedMetadataPropertyTypes` or `AllowedRemoteMetadataPropertyTypes`
              objects to generate the schema from.
          name: the name of the `pydantic.BaseModel` schema to generate. Defaults to "MetadataSchema".
          allow_extra_metadata: whether to allow extra metadata properties or not. Defaults to `True`.
  
      Returns:
          A `pydantic.BaseModel` schema to validate the metadata of a `FeedbackDataset` or `RemoteFeedbackDataset`
          object before inserting them.
  
      Raises:
          ValueError: if one of the metadata properties has an unsupported type.
  
      Examples:
          >>> from argilla.client.feedback.schemas.metadata import IntegerMetadataProperty
          >>> from argilla.client.feedback.dataset.helpers import generate_pydantic_schema_for_metadata
          >>> metadata_properties = [
          ...     IntegerMetadataProperty(name="int_metadata", min=0, max=10),
          ...     ...,
          ... ]
          >>> MetadataSchema = generate_pydantic_schema_for_metadata(metadata_properties)
          >>> MetadataSchema(int_metadata=5)
          MetadataSchema(int-metadata=5)
      """
      metadata_fields, metadata_validators = {}, {}
  
      for metadata_property in metadata_properties or []:
          if metadata_property.type not in [
              arg.value for arg in MetadataPropertyTypes
          ]:
              raise ValueError(
                  f"Metadata property {metadata_property.name} has an unsupported type: {metadata_property.type}, for the moment only the"
                  f" following types are supported: {[arg.value for arg in MetadataPropertyTypes]}"
              )
          (
              pydantic_field,
              pydantic_validator,
          ) = metadata_property._pydantic_field_with_validator
          metadata_fields.update(pydantic_field)
          metadata_validators.update(pydantic_validator)
  
      class MetadataConfig:
          extra = Extra.allow if allow_extra_metadata else Extra.forbid
  
      return create_model(
          name,
          **metadata_fields,
          __validators__=metadata_validators,
          __config__=MetadataConfig,
      )
  
imports: import typing
  from typing import Any, Dict, List, Optional, Type, Union
  import httpx
  from argilla.client.feedback.constants import FIELD_TYPE_TO_PYTHON_TYPE
  from argilla.client.feedback.dataset.base import FeedbackDatasetBase
  from argilla.client.feedback.schemas import FeedbackRecord
  from argilla.client.feedback.schemas.enums import MetadataPropertyTypes
  from argilla.client.feedback.schemas.types import AllowedFieldTypes, AllowedMetadataPropertyTypes, AllowedQuestionTypes
  from argilla.client.sdk.v1.datasets import api
  from argilla.client.sdk.v1.datasets.models import FeedbackDatasetModel
  from argilla.client.singleton import active_client
  from argilla.client.workspaces import Workspace
  from argilla.pydantic_v1 import BaseModel, Extra, ValidationError, create_model
label_desc: Use image node_id 10 for calling a global function with example usage: generate_pydantic_schema_for_metadata(metadata_properties, name, allow_extra_metadata) and returns: create_model