from aiogram.types import InlineKeyboardMarkup, InlineKeyboardButton def menu(data: dict) -> InlineKeyboardMarkup: markup = InlineKeyboardMarkup() for k in data: if k.replace(" ", "") != "": markup.add( InlineKeyboardButton( k, callback_data=str(k) ) ) return markup cancel_button = InlineKeyboardMarkup(inline_keyboard=[ [ InlineKeyboardButton("Назад", callback_data="back") ] ] )