def set_button_flag(card_name, flag_name, flag_value, fields):
    current_card = g.api.task.get_field(g.task_id, f'state.{card_name}')
    if current_card:
        fields[f'state.{card_name}.{flag_name}'] = flag_value
def set_button_flag(card_name, flag_name, flag_value, fields):
    current_card = g.api.task.get_field(g.task_id, f'state.{card_name}')
    if current_card:
        fields[f'state.{card_name}.{flag_name}'] = flag_value