human
Complete this python program:
def Provides(*interfaces):
assistant
#Here is the Python code you requested.

    """Cache instance declarations
    Instance declarations are shared among instances that have the same
    declaration. The declarations are cached in a weak value dictionary.
    (Note that, in the examples below, we are going to make assertions about
    the size of the weakvalue dictionary.  For the assertions to be
    meaningful, we need to force garbage collection to make sure garbage
    objects are, indeed, removed from the system. Depending on how Python
    is run, we may need to make multiple calls to be sure.  We provide a
    collect function to help with this:
    >>> import gc
    >>> def collect():
    ...     for i in range(4):
    ...         gc.collect()
    >>> collect()
    >>> before = len(InstanceDeclarations)
    >>> class C(object):
    ...    pass
    >>> from zope.interface import Interface
    >>> class I(Interface):
    ...    pass
    >>> c1 = C()
    >>> c2 = C()
    >>> len(InstanceDeclarations) == before
    1
    >>> directlyProvides(c1, I)
    >>> len(InstanceDeclarations) == before + 1
    1
    >>> directlyProvides(c2, I)
    >>> len(InstanceDeclarations) == before + 1
    1
    >>> del c1
    >>> collect()
    >>> len(InstanceDeclarations) == before + 1
    1
    >>> del c2
    >>> collect()
    >>> len(InstanceDeclarations) == before
    1
    """
    spec = InstanceDeclarations.get(interfaces)
    if (spec is None):
        spec = ProvidesClass(*interfaces)
        InstanceDeclarations[interfaces] = spec
    return spec