# Buggy code
def create_history_model(self, model, inherited):
    """
    Creates a historical model to associate with the model provided.
    """
    attrs = {"__module__": self.module}

    app_module = "%s.models" % model._meta.app_label

    if inherited:
        # inherited use models module
        attrs["__module__"] = model.__module__
    elif model.__module__ != self.module:
        # registered under different app
        attrs["__module__"] = self.module
    elif app_module != self.module:
        # Abuse an internal API because the app registry is loading.
        app = apps.app_configs[model._meta.app_label]
        models_module = app.name
        attrs["__module__"] = models_module

    fields = self.copy_fields(model)
    attrs.update(fields)
    attrs.update(self.get_extra_fields(model, fields))
    # type in python2 wants str as a first argument
    attrs.update(Meta=type(str("Meta"), (), self.get_meta_options(model)))
    if self.table_name is not None:
        attrs["Meta"].db_table = self.table_name
    name = "Historical%s" % model._meta.object_name
    registered_models[model._meta.db_table] = model
    return python_2_unicode_compatible(type(str(name), self.bases, attrs))


# Traceback (TypeError)
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/srv/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
utility.execute()
File "/srv/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 356, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/srv/venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "/srv/venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute
output = self.handle(*args, **options)
File "/srv/venv/local/lib/python2.7/site-packages/simple_history/management/commands/populate_history.py", line 65, in handle
self._process(to_process, batch_size=options['batchsize'])
File "/srv/venv/local/lib/python2.7/site-packages/simple_history/management/commands/populate_history.py", line 110, in _process
utils.bulk_history_create(model, history_model, batch_size)
File "/srv/venv/local/lib/python2.7/site-packages/simple_history/management/commands/_populate_utils.py", line 28, in bulk_history_create
) for instance in model.objects.all()]
File "/srv/venv/local/lib/python2.7/site-packages/django/db/models/base.py", line 572, in __init__
raise TypeError("'%s' is an invalid keyword argument for this function" % list(kwargs)[0])
TypeError: 'description' is an invalid keyword argument for this function

# Fixed code
def create_history_model(self, model, inherited):
    """
    Creates a historical model to associate with the model provided.
    """
    attrs = {
        "__module__": self.module,
        "_history_excluded_fields": self.excluded_fields,
    }

    app_module = "%s.models" % model._meta.app_label

    if inherited:
        # inherited use models module
        attrs["__module__"] = model.__module__
    elif model.__module__ != self.module:
        # registered under different app
        attrs["__module__"] = self.module
    elif app_module != self.module:
        # Abuse an internal API because the app registry is loading.
        app = apps.app_configs[model._meta.app_label]
        models_module = app.name
        attrs["__module__"] = models_module

    fields = self.copy_fields(model)
    attrs.update(fields)
    attrs.update(self.get_extra_fields(model, fields))
    # type in python2 wants str as a first argument
    attrs.update(Meta=type(str("Meta"), (), self.get_meta_options(model)))
    if self.table_name is not None:
        attrs["Meta"].db_table = self.table_name
    name = "Historical%s" % model._meta.object_name
    registered_models[model._meta.db_table] = model
    return python_2_unicode_compatible(type(str(name), self.bases, attrs))