Refactored python client into a reusable module