'Return a dictionary mapping field names to a dictionary of
additional keyword arguments.'

def get_extra_kwargs(self):

    extra_kwargs = copy.deepcopy(getattr(self.Meta, u'extra_kwargs', {}))
    read_only_fields = getattr(self.Meta, u'read_only_fields', None)
    if (read_only_fields is not None):
        if (not isinstance(read_only_fields, (list, tuple))):
            raise TypeError((u'The    `read_only_fields`    option    must    be    a    list    or    tuple.    Got    %s.' % type(read_only_fields).__name__))
        for field_name in read_only_fields:
            kwargs = extra_kwargs.get(field_name, {})
            kwargs[u'read_only'] = True
            extra_kwargs[field_name] = kwargs
    else:
        assert (not hasattr(self.Meta, u'readonly_fields')), (u'Serializer    `%s.%s`    has    field    `readonly_fields`;    the    correct    spelling    for    the    option    is    `read_only_fields`.' % (self.__class__.__module__, self.__class__.__name__))
    return extra_kwargs
