def split_dict(d, criteria):
    """Split a dict d into two dicts based on a criteria on the keys."""
    a = {}
    b = {}
    for k, v in d.items():
        if criteria(k):
            a[k] = v
        else:
            b[k] = v
    return a, b
