'Run a beets command with an arbitrary amount of arguments. The
Library` defaults to `self.lib`, but can be overridden with
the keyword argument `lib`.'

def run_command(self, *args, **kwargs):

    sys.argv = ['beet']
    lib = None
    if hasattr(self, 'lib'):
        lib = self.lib
    lib = kwargs.get('lib', lib)
    beets.ui._raw_main(_convert_args(list(args)), lib)
