def dict_merge(base, override):
    """Recursively merge two dictionaries

    Parameters
    ----------
    base : dict
        Base dictionary for merge
    override : dict
        dictionary to override values from base with

    Returns
    -------
    dict
        Merged dictionary of base and overrides
    """
    # recursively merges dictionaries a and b, using b
    # as the overrides where applicable
    merged = base.copy()
    for k, v in override.items():
        if k in merged:
            if isinstance(merged[k], dict) and isinstance(v, dict):
                merged[k] = dict_merge(merged[k], v)
            elif isinstance(merged[k], set) and isinstance(v, set):
                merged[k] = merged[k].union(v)
            else:
                merged[k] = v
        else:
            merged[k] = v
    return merged