The `UserProfile` class is imported here. Couldn't that be used instead of `profile.__class__`?