cleans up Python driver code as per review