def addfinalizer(self, finalizer, colitem):
assert colitem and not isinstance(colitem, tuple)<EOL>assert callable(finalizer)<EOL>self._finalizers.setdefault(colitem, []).append(finalizer)<EOL>
attach a finalizer to the given colitem.
        if colitem is None, this will add a finalizer that
        is called at the end of teardown_all().