@contextlib.contextmanager
def check_c_ext(self, extdir, name):
    sys.path.append(extdir)
    try:
        lib = import_dynamic(name)
        (yield lib)
    finally:
        sys.path.remove(extdir)
        sys.modules.pop(name, None)
@contextlib.contextmanager
def check_c_ext(self, extdir, name):
    sys.path.append(extdir)
    try:
        lib = import_dynamic(name)
        (yield lib)
    finally:
        sys.path.remove(extdir)
        sys.modules.pop(name, None)