def METHOD_NAME(cls, model_class, parent, kwargs):
    instance = model_class(**kwargs)
    if parent:
        parent.add_child(instance=instance)
    else:
        model_class.add_root(instance=instance)
    return instance