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