<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_user_and_user_email_by_id(self, user_or_user_email_id):
 """Retrieve the User and UserEmail object by ID."""

        if self.UserEmailClass:
            user_email = self.db_adapter.get_object(self.UserEmailClass, user_or_user_email_id)
            user = user_email.user if user_email else None
        else:
            user = self.db_adapter.get_object(self.UserClass, user_or_user_email_id)
            user_email = user
        return (user, user_email)