docs: def _format_fields(cls, declared_fields: typing.List[tuple]):
          """Process declared fields and construct a list of tuples
          that can be fed into dataclass constructor factory.
          """
          formatted_fields = []
          for declared_field in declared_fields:
              field_name = field_type = field_defn = None
  
              # Case when only (name), or "name", is specified
              if isinstance(declared_field, str) or len(declared_field) == 1:
                  field_name = declared_field
                  field_type = typing.Any
                  field_defn = field(default=None)
  
              # Case when (name, type) are specified
              elif len(declared_field) == 2:
                  field_name = declared_field[0]
                  field_type = declared_field[1]
                  field_defn = field(default=None)
  
              # Case when (name, type, field) are specified
              elif len(declared_field) == 3:
                  field_name = declared_field[0]
                  field_type = declared_field[1]
  
                  # Process the definition and create a `field` object
                  # Definition will be of the form `{'required': False, 'default': 'John'}`
                  assert isinstance(declared_field[2], dict)
                  metadata = default = None
                  if 'required' in declared_field[2] and declared_field[2]['required']:
                      metadata = {'required': True}
                  if 'default' in declared_field[2]:
                      default = declared_field[2]['default']
                  field_defn = field(default=default, metadata=metadata)
  
              formatted_fields.append((field_name, field_type, field_defn))
  
          return formatted_fields