python client refactored