<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_capability(self, cls):
 """Add a capability to this object."""

        if _debug: Collector._debug("add_capability %r", cls)

        # the new type has everything the current one has plus this new one
        bases = (self.__class__, cls)
        if _debug: Collector._debug("    - bases: %r", bases)

        # save this additional class
        self.capabilities.append(cls)

        # morph into a new type
        newtype = type(self.__class__.__name__ + '+' + cls.__name__, bases, {})
        self.__class__ = newtype

        # allow the new type to init
        if hasattr(cls, '__init__'):
            if _debug: Collector._debug("    - calling %r.__init__", cls)
            cls.__init__(self)