an updated version that works with Python 3.3