def remove_duplicates(apps, schema_editor):
<EOL>EntityRelationship = apps.get_model('<STR_LIT>', '<STR_LIT>')<EOL>duplicates = EntityRelationship.objects.all().order_by(<EOL>'<STR_LIT>',<EOL>'<STR_LIT>'<EOL>).values(<EOL>'<STR_LIT>',<EOL>'<STR_LIT>'<EOL>).annotate(<EOL>Count('<STR_LIT>'),<EOL>Count('<STR_LIT>'),<EOL>max_id=Max('<STR_LIT:id>')<EOL>).filter(<EOL>super_entity_id__count__gt=<NUM_LIT:1><EOL>)<EOL>for duplicate in duplicates:<EOL><INDENT>EntityRelationship.objects.filter(<EOL>sub_entity_id=duplicate['<STR_LIT>'],<EOL>super_entity_id=duplicate['<STR_LIT>']<EOL>).exclude(<EOL>id=duplicate['<STR_LIT>']<EOL>).delete()<EOL><DEDENT>
Remove any duplicates from the entity relationship table
:param apps:
:param schema_editor:
:return: