def _filter(src, dst, t):
    """filters out invalid copies after chaining"""
    for k, v in list(t.items()):
        if v not in src:
            del t[k]
        elif k in src and v in dst:
            del t[k]
        elif k not in dst:
            del t[k]
