def get_chat_id(self, username):
if username is not None:<EOL><INDENT>chats = requests.get(self.base_url + "<STR_LIT>").json()<EOL>user = username.split("<STR_LIT:@>")[-<NUM_LIT:1>]<EOL>for chat in chats["<STR_LIT:result>"]:<EOL><INDENT>if chat["<STR_LIT:message>"]["<STR_LIT>"]["<STR_LIT:username>"] == user:<EOL><INDENT>return chat["<STR_LIT:message>"]["<STR_LIT>"]["<STR_LIT:id>"]<EOL><DEDENT><DEDENT><DEDENT>
Lookup chat_id of username if chat_id is unknown via API call.