code: def get_arg_model(
      func: Callable,
      *,
      exclude: Iterable[str] = tuple(),
      name: str = "ArgModel",
      strict: bool = True,
  ) -> ModelMetaclass:
      """Generate a pydantic model for function arguments.
  
      func (Callable): The function to generate the schema for.
      exclude (Iterable[str]): Parameter names to ignore.
      name (str): Name of created model class.
      strict (bool): Don't allow extra arguments if no variable keyword arguments
          are allowed on the function.
      RETURNS (ModelMetaclass): A pydantic model.
      """
      sig_args = {}
      try:
          sig = inspect.signature(func)
      except ValueError:
          # Typically happens if the method is part of a Cython module without
          # binding=True. Here we just use an empty model that allows everything.
          return create_model(name, __config__=ArgSchemaConfigExtra)  # type: ignore[arg-type, return-value]
      has_variable = False
      for param in sig.parameters.values():
          if param.name in exclude:
              continue
          if param.kind == param.VAR_KEYWORD:
              # The function allows variable keyword arguments so we shouldn't
              # include **kwargs etc. in the schema and switch to non-strict
              # mode and pass through all other values
              has_variable = True
              continue
          # If no annotation is specified assume it's anything
          annotation = (
              param.annotation
              if param.annotation != param.empty
              else Any
          )
          # If no default value is specified assume that it's required. Cython
          # functions/methods will have param.empty for default value None so we
          # need to treat them differently
          default_empty = None if is_cython_func(func) else ...
          default = (
              param.default
              if param.default != param.empty
              else default_empty
          )
          sig_args[param.name] = (annotation, default)
      is_strict = strict and not has_variable
      sig_args["__config__"] = ArgSchemaConfig if is_strict else ArgSchemaConfigExtra  # type: ignore[assignment]
      return create_model(name, **sig_args)
  
imports: import inspect
  import re
  from collections import defaultdict
  from enum import Enum
  from typing import TYPE_CHECKING, Any, Callable, Dict, Iterable, List, Optional, Tuple, Type, TypeVar, Union
  from thinc.api import ConfigValidationError, Model, Optimizer
  from thinc.config import Promise
  from .attrs import NAMES
  from .compat import Literal
  from .lookups import Lookups
  from .util import is_cython_func
label_desc: Use image node_id 2 for calling a global function with example usage: get_arg_model(func) and returns: create_model, create_model