def METHOD_NAME(ext_point):
    if isinstance(ext_point, str):
        ext_point = to_function(ext_point)
    extensions = ext_point.extensions
    ext_point.extensions = []
    try:
        yield
    finally:
        ext_point.extensions = extensions