'Check that `fields` only refer to existing fields, doesn\'t contain
duplicates. Check if at most one of `fields` and `fieldsets` is defined.'

def _check_fields(self, obj):

    if (obj.fields is None):
        return []
    elif (not isinstance(obj.fields, (list, tuple))):
        return must_be('a    list    or    tuple', option='fields', obj=obj, id='admin.E004')
    elif obj.fieldsets:
        return [checks.Error("Both    'fieldsets'    and    'fields'    are    specified.", obj=obj.__class__, id='admin.E005')]
    fields = flatten(obj.fields)
    if (len(fields) != len(set(fields))):
        return [checks.Error("The    value    of    'fields'    contains    duplicate    field(s).", obj=obj.__class__, id='admin.E006')]
    return list(chain.from_iterable((self._check_field_spec(obj, obj.model, field_name, 'fields') for field_name in obj.fields)))
