human
Complete this python program:
def implementedByFallback(cls):
assistant
#Here is the Python code you requested.

    """Return the interfaces implemented for a class\ instances
    The value returned is an IDeclaration.
    for example:
    >>> from zope.interface import Interface
    >>> class I1(Interface): pass
    >>> class I2(I1): pass
    >>> class I3(Interface): pass
    >>> class I4(I3): pass
    >>> class C1(object):
    ...   implements(I2)
    >>> class C2(C1):
    ...   implements(I3)
    >>> [i.getName() for i in implementedBy(C2)]
    [\I3\, \I2\]
    Really, any object should be able to receive a successful answer, even
    an instance:
    >>> class Callable(object):
    ...     def __call__(self):
    ...         return self
    >>> implementedBy(Callable())
    <implementedBy zope.interface.declarations.?>
    Note that the name of the spec ends with a \?\, because the `Callable`
    instance does not have a `__name__` attribute.
    """
    try:
        spec = cls.__dict__.get('__implemented__')
    except AttributeError:
        spec = getattr(cls, '__implemented__', None)
        if (spec is None):
            spec = BuiltinImplementationSpecifications.get(cls)
            if (spec is not None):
                return spec
            return _empty
        if (spec.__class__ == Implements):
            return spec
        return Declaration(*_normalizeargs((spec,)))
    if isinstance(spec, Implements):
        return spec
    if (spec is None):
        spec = BuiltinImplementationSpecifications.get(cls)
        if (spec is not None):
            return spec
    if (spec is not None):
        spec = (spec,)
        spec = Implements(*_normalizeargs(spec))
        spec.inherit = None
        del cls.__implemented__
    else:
        try:
            bases = cls.__bases__
        except AttributeError:
            if (not callable(cls)):
                raise TypeError('ImplementedBy    called    for    non-factory', cls)
            bases = ()
        spec = Implements(*[implementedBy(c) for c in bases])
        spec.inherit = cls
    spec.__name__ = (((getattr(cls, '__module__', '?') or '?') + '.') + (getattr(cls, '__name__', '?') or '?'))
    try:
        cls.__implemented__ = spec
        if (not hasattr(cls, '__providedBy__')):
            cls.__providedBy__ = objectSpecificationDescriptor
        if (isinstance(cls, DescriptorAwareMetaClasses) and ('__provides__' not in cls.__dict__)):
            cls.__provides__ = ClassProvides(cls, getattr(cls, '__class__', type(cls)))
    except TypeError:
        if (not isinstance(cls, type)):
            raise TypeError('ImplementedBy    called    for    non-type', cls)
        BuiltinImplementationSpecifications[cls] = spec
    return spec