'Wrap `func` to temporarily set this plugin\'s logger level to
`base_log_level` + config options (and restore it to its previous
value after the function returns). Also determines which params may not
be sent for backwards-compatibility.'

def _set_log_level_and_params(self, base_log_level, func):

    argspec = inspect.getargspec(func)
    @wraps(func)
    def wrapper(*args, **kwargs):
        assert (self._log.level == logging.NOTSET)
        verbosity = beets.config['verbose'].get(int)
        log_level = max(logging.DEBUG, (base_log_level - (10 * verbosity)))
        self._log.setLevel(log_level)
        try:
            return func(*args, **kwargs)
        except TypeError as exc:
            if exc.args[0].startswith(func.__name__):
                kwargs = dict(((arg, val) for (arg, val) in kwargs.items() if (arg in argspec.args)))
                return func(*args, **kwargs)
            else:
                raise
        finally:
            self._log.setLevel(logging.NOTSET)
    return wrapper
