Checks if user has role

def has_role(self, role_or_handle):
        """ Checks if user has role """
        if not isinstance(role_or_handle, str):
            return role_or_handle in self.roles

        has_role = False
        for role in self.roles:
            if role.handle == role_or_handle:
                has_role = True
                break

        return has_role