def METHOD_NAME(primary_object, alias_object):
    """Merge several model instances into one, the `primary_object`.
    Use this function to merge model objects and migrate all of the related
    fields from the alias objects the primary object.
    Usage:
        from django.contrib.auth.models import User
        primary_user = User.objects.get(email='good@example.com')
        duplicate_user = User.objects.get(email='good+duplicate@example.com')
        merge(primary_user, duplicate_user)
    Based on: https://djangosnippets.org/snippets/382/
    """
    generic_fields = get_generic_fields()
    # get related fields
    many_to_many_fields, related_fields = discrimine(
        lambda field: isinstance(field, ManyToManyRel),
        primary_object._meta._get_fields(forward=False, include_hidden=True)
    )
    # Migrate all foreign key references from alias object to primary
    # object.
    for related_object in related_fields:
        # The variable name on the alias_object model.
        alias_varname = related_object.get_accessor_name()
        # The variable name on the related model.
        obj_varname = related_object.field.name
        if isinstance(related_object, OneToOneRel):
            obj = getattr(alias_object, alias_varname, None)
            if obj is not None:
                setattr(obj, obj_varname, primary_object)
                obj.save()
        else:
            # FIXME: Not sure why or how this even appears!
            if alias_varname == 'Report_organisations+':
                print('Could not find alias_varname: {}'.format(alias_varname))
                print(alias_object, alias_varname, related_object, obj_varname)
                continue
            related_objects = getattr(alias_object, alias_varname)
            for obj in related_objects.all():
                setattr(obj, obj_varname, primary_object)
                # If unique together constraints are failed to be met, we
                # delete the object, where we tried to replace alias_object
                # with primary_object.
                with transaction.atomic():
                    try:
                        obj.save()
                        saved = True
                    except IntegrityError as e:
                        print(e)
                        saved = False
                if not saved:
                    obj.delete()
    # Migrate all many to many references from alias object to primary
    # object.
    for related_many_object in many_to_many_fields:
        alias_varname = related_many_object.get_accessor_name()
        obj_varname = related_many_object.field.name
        related_many_objects = getattr(alias_object, alias_varname)
        for obj in related_many_objects.all():
            getattr(obj, obj_varname).remove(alias_object)
            getattr(obj, obj_varname).add(primary_object)
    # Migrate all generic foreign key references from alias object to
    # primary object.
    for field in generic_fields:
        filter_kwargs = {}
        filter_kwargs[field.fk_field] = alias_object._get_pk_val()
        filter_kwargs[field.ct_field] = field.get_content_type(alias_object)
        related_objects = field.model.objects.filter(**filter_kwargs)
        for generic_related_object in related_objects:
            setattr(generic_related_object, field.name, primary_object)
            generic_related_object.save()
    if alias_object.id:
        alias_object.delete()
    return primary_object