'Returns the list of all field names that should be created when
instantiating this serializer class. This is based on the default
set of fields, but also takes into account the `Meta.fields` or
`Meta.exclude` options if they have been specified.'

def get_field_names(self, declared_fields, info):

    fields = getattr(self.Meta, u'fields', None)
    exclude = getattr(self.Meta, u'exclude', None)
    if (fields and (fields != ALL_FIELDS) and (not isinstance(fields, (list, tuple)))):
        raise TypeError((u'The    `fields`    option    must    be    a    list    or    tuple    or    "__all__".    Got    %s.' % type(fields).__name__))
    if (exclude and (not isinstance(exclude, (list, tuple)))):
        raise TypeError((u'The    `exclude`    option    must    be    a    list    or    tuple.    Got    %s.' % type(exclude).__name__))
    assert (not (fields and exclude)), u"Cannot    set    both    'fields'    and    'exclude'    options    on    serializer    {serializer_class}.".format(serializer_class=self.__class__.__name__)
    assert (not ((fields is None) and (exclude is None))), (u"Creating    a    ModelSerializer    without    either    the    'fields'    attribute    or    the    'exclude'    attribute    has    been    deprecated    since    3.3.0,    and    is    now    disallowed.    Add    an    explicit    fields    =    '__all__'    to    the    {serializer_class}    serializer.".format(serializer_class=self.__class__.__name__),)
    if (fields == ALL_FIELDS):
        fields = None
    if (fields is not None):
        required_field_names = set(declared_fields)
        for cls in self.__class__.__bases__:
            required_field_names -= set(getattr(cls, u'_declared_fields', []))
        for field_name in required_field_names:
            assert (field_name in fields), u"The    field    '{field_name}'    was    declared    on    serializer    {serializer_class},    but    has    not    been    included    in    the    'fields'    option.".format(field_name=field_name, serializer_class=self.__class__.__name__)
        return fields
    fields = self.get_default_field_names(declared_fields, info)
    if (exclude is not None):
        for field_name in exclude:
            assert (field_name in fields), u"The    field    '{field_name}'    was    included    on    serializer    {serializer_class}    in    the    'exclude'    option,    but    does    not    match    any    model    field.".format(field_name=field_name, serializer_class=self.__class__.__name__)
            fields.remove(field_name)
    return fields
