<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def plugin_for(cls, model):
        '''
        Find and return a plugin for this model. Uses inheritance to find a model where the plugin is registered.
        '''
        logger.debug("Getting a plugin for: %s", model)
        if not issubclass(model, Model):
            return
        if model in cls.plugins:
            return cls.plugins[model]
        for b in model.__bases__:
            p = cls.plugin_for(b)
            if p:
                return p