<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def has_perm(self, user, perm, obj=None):
 """Returns True if the given user has the specified permission."""

        if not user.is_active:
            return False
        return perm in self.get_all_permissions(user, obj)