from typing import OrderedDict


def _deep_convert_dict(layer):
    """Helper function to convert dictionary back from OrderedDict"""
    to_ret = layer
    if isinstance(layer, OrderedDict):
        to_ret = dict(layer)
    try:
        for key, value in list(to_ret.items()):
            to_ret[key] = _deep_convert_dict(value)
    except AttributeError:
        pass
    return to_ret