refactor Python client for sync