import warnings
import pkg_resources
import functools

def custom_warning_filter(message, category, filename, lineno, file=None, line=None):
    if (category == DeprecationWarning and
            "Deprecated call to `pkg_resources.declare_namespace" in str(message)):
        return None
    return True

warnings.filterwarnings("ignore", category=DeprecationWarning, module="pkg_resources")
warnings.showwarning = custom_warning_filter

original_declare_namespace = pkg_resources.declare_namespace

@functools.wraps(original_declare_namespace)
def declare_namespace_wrapper(name):
    return original_declare_namespace(name)

pkg_resources.declare_namespace = declare_namespace_wrapper
