replace D version with Python version, based on mwclient