import copy


def flatten_dict(data: dict, delimiter: str = "/") -> dict:
    """
    Overview:
        flatten the dict, see example
    Arguments:
        data (:obj:`dict`): Original nested dict
        delimiter (str): Delimiter of the keys of the new dict
    Returns:
        - (:obj:`dict`): Flattened nested dict
    Example:
        Flatten nested dict:
            {
                'a': {
                    'aa': {'aaa': data-aaa},
                    'ab': data-ab
                }
            }
        to:
            {
                'a/ab': data-ab,
                'a/aa/aaa': data-aaa
            }
    """
    data = copy.deepcopy(data)
    while any(isinstance(v, dict) for v in data.values()):
        remove = []
        add = {}
        for key, value in data.items():
            if isinstance(value, dict):
                for subkey, v in value.items():
                    add[delimiter.join([key, subkey])] = v
                remove.append(key)
        data.update(add)
        for k in remove:
            del data[k]
    return data