<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def __parse_identities(self, stream):
 """Parse identities stream"""


        for aliases in self.__parse_stream(stream):
            identity = self.__parse_alias(aliases[0])
            uuid = identity.email

            uid = self._identities.get(uuid, None)

            if not uid:
                uid = UniqueIdentity(uuid=uuid)
                identity.uuid = uuid
                uid.identities.append(identity)
                self._identities[uuid] = uid

                profile = Profile(uuid=uuid, name=identity.name, email=identity.email,
                                  is_bot=False)
                uid.profile = profile

            # Aliases
            for alias in aliases[1:]:
                identity = self.__parse_alias(alias, uuid)
                uid.identities.append(identity)

            self._identities[uuid] = uid