<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def getattr(self, key, default=None, callback=None):
 u"""Getting the attribute of an element. 'text' 'TEXT' 'default' """

        value = self._xml.text if key == 'text' else self._xml.get(key, default)
        return callback(value) if callback else value