implements #640 in Python driver