def add_component(self, component):
        """
        Add a component to this composite.

        @param component: The component to add to this Composite
        @raise AttributeError: If the component does not adhere to this Composites interface.
        """
        valid = False
        try:
            if component.interface == self.interface:
                valid = True
        except AttributeError:
            if self.interface in component.__class__.__mro__:
                valid = True
        finally:
            if valid:
                self.components.add(component)
            else:
                raise AttributeError('Component {0} does not follow this composites interface {1}'.format(
                    component.__class__, self.interface))

        Add a component to this composite.

        @param component: The component to add to this Composite
        @raise AttributeError: If the component does not adhere to this Composites interface.
        
pypattyrn/structural/composite.py