docs: def select2_modelform_meta(model,
                             meta_fields=None,
                             widgets=None,
                             attrs=None,
                             **kwargs):
      """
      Return `Meta` class with Select2-enabled widgets for fields
      with choices (e.g.  ForeignKey, CharField, etc) for use with
      ModelForm.
  
      Arguments:
          model - a model class to create `Meta` class for.
          meta_fields - dictionary with `Meta` class fields, for
              example, {'fields': ['id', 'name']}
          attrs - select2 widget attributes (width, for example),
              must be of type `dict`.
          **kwargs - will be merged with meta_fields.
      """
      widgets = widgets or {}
      meta_fields = meta_fields or {}
  
      # TODO: assert attrs is of type `dict`
  
      for field in model._meta.fields:
          if isinstance(field, ForeignKey) or field.choices:
              widgets.update({field.name: Select2(select2attrs=attrs)})
  
      for field in model._meta.many_to_many:
          widgets.update({field.name: Select2Multiple(select2attrs=attrs)})
  
      meta_fields.update({
          'model': model,
          'widgets': widgets,
      })
      if 'exclude' not in kwargs and 'fields' not in kwargs:
          meta_fields.update({'exclude': []})
      meta_fields.update(**kwargs)
      meta = type('Meta', (object,), meta_fields)
  
      return meta