'Check that fieldsets is properly formatted and doesn\'t contain
duplicates.'

def _check_fieldsets(self, obj):

    if (obj.fieldsets is None):
        return []
    elif (not isinstance(obj.fieldsets, (list, tuple))):
        return must_be('a    list    or    tuple', option='fieldsets', obj=obj, id='admin.E007')
    else:
        return list(chain.from_iterable((self._check_fieldsets_item(obj, obj.model, fieldset, ('fieldsets[%d]' % index)) for (index, fieldset) in enumerate(obj.fieldsets))))
