Use internal WeakSet if unable to import (users of Python < 2.7)

Use the WeakSet implementation from https://code.google.com/p/weakrefset/source/browse/weakrefset.py if unable to import from weakref (users of python < 2.7).