import copy


def filter_dict(target_dict, keys_to_filter):
    """Filters key(s) from top level of a dict
    Args:
        target_dict (dict): the dictionary to filter
        keys_to_filter (list, tuple, str): set of keys to filter
    Returns:
        A filtered copy of target_dict
    """
    assert isinstance(target_dict, dict)
    d = copy.deepcopy(target_dict)
    # Let keys_to_filter be a single string or a tuple of values
    if isinstance(keys_to_filter, str):
        keys_to_filter = [keys_to_filter]
    elif isinstance(keys_to_filter, tuple):
        keys_to_filter = list(keys_to_filter)
    elif keys_to_filter is None:
        keys_to_filter = []
    # Do the filtering
    for kf in keys_to_filter:
        try:
            d.pop(kf)
        except KeyError:
            pass
    return d