def unflatten_mapping(mapping):
    """Unflatten a dict with dot-concatenated keys to a dict of dicts

    Examples
    --------
    >>> x = {'a1.b1.c1': 1,
    ...      'a1.b2': 2,
    ...      'a2.b1': 3}
    >>> unflatten_mapping(x)  # doctest: +SKIP
    {'a1': {'b1': {'c1': 1},
     'b2': 2},
     'a2': {'b1': 3}}
    """
    out = {}
    for k, v in mapping.items():
        keys = k.split('.')
        o = out
        for k2 in keys[:-1]:
            o = o.setdefault(k2, {})
        o[keys[-1]] = v
    return out