<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def declarative_fields(cls_filter, meta_base=type, extra_attr_name='base_fields'):
 """ Metaclass that converts Field attributes to a dictionary called 'base_fields', taking into account parent class 'cls_filter'. """

    def __new__(cls, name, bases, attrs):
        attrs[extra_attr_name] = fields = get_declared_fields(bases, attrs, cls_filter,
                extra_attr_name=extra_attr_name)
        attrs[extra_attr_name + '_names'] = set(fields.keys())
        new_class = meta_base.__new__(cls, name, bases, attrs)
        return new_class

    return type('', (meta_base,), {'__new__': __new__})