def subdivide_stats(data):
    """
    If a key contains a ., create a sub-dict with the first part as parent key
    """
    ret = {}
    for key, value in data.items():
        if '.' in key:
            parent, subkey = key.split('.', 2)
            if parent not in ret:
                ret[parent] = {}
            ret[parent][subkey] = value
        else:
            ret[key] = value
    return ret