<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def bind(self, container):
 """ Get an instance of this Extension to bind to `container`. """


        def clone(prototype):
            if prototype.is_bound():
                raise RuntimeError('Cannot `bind` a bound extension.')

            cls = type(prototype)
            args, kwargs = prototype.__params
            instance = cls(*args, **kwargs)
            # instance.container must be a weakref to avoid a strong reference
            # from value to key in the `shared_extensions` weakkey dict
            # see test_extension_sharing.py: test_weakref
            instance.container = weakref.proxy(container)
            return instance

        instance = clone(self)

        # recurse over sub-extensions
        for name, ext in inspect.getmembers(self, is_extension):
            setattr(instance, name, ext.bind(container))
        return instance