synchronizing keys without aligning objects

I need a script that would create or delete animation keys from the referenced (selected) object A to object(s) B without aligning the position B to A.

For example.
1. Object A, which has animation with 5 keys (PRS) in frames: 0.20,25.45 and 50.
2. Object B, which does not have keys at all, or has animation keys from 0 to 100, or has 1,5,14,48... does not matter.
3. after applying the script object B received the keys form object A ( 0,20,25,45 and 50) all other keys must be removed.
the position of object B, should not be aligned with the position of object A.
maybe someone has such a script?