code: def __init__(self, fields=None, **kwargs):
      if fields is not None:
          self.fields = {**fields, **kwargs}
      else:
          self.fields = kwargs
  
      self.columns = {}
      self.time_series_ref = None
      self.static = {}
      self.metadata = {}
  
      for name, ty in self.fields.items():
          if isinstance(ty, TimeSeries):
              self.columns[name] = ty
          elif isinstance(ty, Metadata):
              self.metadata[name] = ty
          elif isinstance(ty, (Scalar, Array)):
              self.static[name] = ty
          else:
              raise ValueError(f"Unknown field type for {name}")
  
      if self.columns:
          try:
              self.time_series_ref = next(
                  name
                  for name in self.columns
                  if self.fields[name].required
              )
          except StopIteration:
              raise ValueError(
                  "At least one time series needs to be required."
              )
  
imports: from typing import Any, Callable, Optional, Union, Type, Dict
  import numpy
  from gluonts.itertools import partition
  from gluonts.pydantic import parse_obj_as, BaseModel
  from ._freq import Freq
  from ._period import Period
  from ._time_frame import time_frame, TimeFrame
  from ._split_frame import split_frame, SplitFrame
label_desc: Use image node_id 1 to create a new Schema object  with example: obj = Schema(fields)