<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_attributes(self, data, type):
 """ add required attributes """

        for attr, ancestry in type.attributes():
            name = '_%s' % attr.name
            value = attr.get_default()
            setattr(data, name, value)