<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def hasAttribute(self, attr: str) -> bool: """Return True if this node has ``attr``."""

        if attr == 'class':
            return bool(self.classList)
        return attr in self.attributes