def _generate_upload_key(self, allow_timeout=False):
<EOL>while not self.user.nick:<EOL><INDENT>with ARBITRATOR.condition:<EOL><INDENT>ARBITRATOR.condition.wait()<EOL><DEDENT><DEDENT>while True:<EOL><INDENT>params = {<EOL>"<STR_LIT:name>": self.user.nick,<EOL>"<STR_LIT>": self.room_id,<EOL>"<STR_LIT:c>": self.__upload_count,<EOL>}<EOL>if self.key:<EOL><INDENT>params["<STR_LIT>"] = self.key<EOL><DEDENT>if self.password:<EOL><INDENT>params["<STR_LIT:password>"] = self.password<EOL><DEDENT>info = self.conn.make_api_call("<STR_LIT>", params)<EOL>self.__upload_count += <NUM_LIT:1><EOL>try:<EOL><INDENT>return info["<STR_LIT:key>"], info["<STR_LIT>"], info["<STR_LIT>"]<EOL><DEDENT>except Exception:<EOL><INDENT>to = int(info.get("<STR_LIT:error>", {}).get("<STR_LIT:info>", {}).get("<STR_LIT>", <NUM_LIT:0>))<EOL>if to <= <NUM_LIT:0> or not allow_timeout:<EOL><INDENT>raise IOError(f"<STR_LIT>")<EOL><DEDENT>time.sleep(to / <NUM_LIT>)<EOL><DEDENT><DEDENT>
Generates a new upload key