Python gurus, is there a better way to go about this?

For these specific manipulations, we need to add any custom query strings before doing the manipulation.