Purge by key and a Python 3 compatibility update

As per topic