<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _generate_upload_key(self, allow_timeout=False):
 """Generates a new upload key"""


        # Wait for server to set username if not set already.
        while not self.user.nick:
            with ARBITRATOR.condition:
                ARBITRATOR.condition.wait()
        while True:
            params = {
                "name": self.user.nick,
                "room": self.room_id,
                "c": self.__upload_count,
            }
            if self.key:
                params["roomKey"] = self.key
            if self.password:
                params["password"] = self.password
            info = self.conn.make_api_call("getUploadKey", params)
            self.__upload_count += 1
            try:
                return info["key"], info["server"], info["file_id"]
            except Exception:
                to = int(info.get("error", {}).get("info", {}).get("timeout", 0))
                if to <= 0 or not allow_timeout:
                    raise IOError(f"Failed to retrieve key {info}")
                time.sleep(to / 10000)