Posts Taggedswapping logic in python