def linearize_dict(indict, sep='_', lower=False):
    """Linearize levels of an input dict, using separator

    Args:
        indict(`dict`): input dict with nested levels
        sep(str): separator
        lower(bool): lower all itens

    Returns:
        `dict`: output dict with just one level

    """

    def linearize_level(level, sep, lower, suffix=''):

        outdict = {}
        for i in level.keys():
            new_suffix = suffix + i.lower() if lower else suffix + i

            if isinstance(level[i], dict):
                part = linearize_level(level[i], sep, lower, new_suffix + sep)
                outdict.update(part)
            else:
                outdict[new_suffix] = level[i]

        return outdict

    return linearize_level(indict, sep, lower)