def merge_dicts(a, b, allow_key_overlap=True):
    """
    Returns a dict that merges a and b. Entries of b take priority over entries of a.
    """
    if not allow_key_overlap:
        k = set(a.keys()).intersection(b.keys())
        assert len(k) == 0

    out = {k: v for (k, v) in a.items()}
    out.update(b)
    return out