def get_anonymous_profile(self): profile = Profile() profile.is_authenticated = False while True: pk = random.randrange(0, 10001, 2) username = '******' % pk if not HWIOS.ws_realm.pool.name_taken(username): profile.username = username profile.pk = pk try: profile.uuid = uuid.uuid5(uuid.NAMESPACE_DNS, str(self.session_id)) except AttributeError: profile.uuid = uuid.uuid5(uuid.NAMESPACE_DNS, self.transport.getPeer().host) break return profile