from typing import Dict
from typing import Any
from typing import List
from typing import OrderedDict


def flatten_dict(data: Dict[str, Any], parent_key='') -> Dict[str, str]:
    """
    flatten dict

    input: OrderedDict([
        ('a', OrderedDict([('b', 2), ('c', 1)])),
        ('b', 1),
        ('c', 'c_st[ring]')
    ])
    output: OrderedDict([
        ('a[b]', 2),
        ('a[c]', 1),
        ('b', 1),
        ('c', 'c_st[ring]')
    ])
    """
    lst: List = []
    for k, v in data.items():
        new_key = f'{parent_key}[{k}]' if parent_key else k
        if isinstance(v, dict):
            lst.extend(flatten_dict(v, new_key).items())
        else:
            lst.append((new_key, v))
    return OrderedDict(lst)