Expand all compound keys (at any depth) into nested dicts

        In [13]: d  = {'test.test2': {'k1.k2': 'val'}}
        In [14]: flange.expand(d)
        Out[14]: {'test.test2': {'k1': {'k2': 'val'}}}

    :param data: input dict
    :param separator: separator in compound keys
    :param replace: if true, remove the compound key. Otherwise the value will
    exist under the compound and expanded key
    :return: copy of input dict with expanded keys

def unflatten(data, separator='.', replace=True):
    '''
    Expand all compound keys (at any depth) into nested dicts

        In [13]: d  = {'test.test2': {'k1.k2': 'val'}}
        In [14]: flange.expand(d)
        Out[14]: {'test.test2': {'k1': {'k2': 'val'}}}

    :param data: input dict
    :param separator: separator in compound keys
    :param replace: if true, remove the compound key. Otherwise the value will
    exist under the compound and expanded key
    :return: copy of input dict with expanded keys
    '''
    if not separator:
        return data
    return remap({'temp':data}, visit=lambda p, k, v: __expand_keys(k, v, separator, replace))['temp']