pub, sub, and getMore commands logic written in python