'Base command for repoquery'

def _repoquery_cmd(self, cmd, output=False, output_type='json'):

    cmds = ['/usr/bin/repoquery', '--plugins', '--quiet']
    cmds.extend(cmd)
    rval = {}
    results = ''
    err = None
    if self.verbose:
        print '    '.join(cmds)
    (returncode, stdout, stderr) = _run(cmds)
    rval = {'returncode': returncode, 'results': results, 'cmd': '    '.join(cmds)}
    if (returncode == 0):
        if output:
            if (output_type == 'raw'):
                rval['results'] = stdout
        if self.verbose:
            print stdout
            print stderr
        if err:
            rval.update({'err': err, 'stderr': stderr, 'stdout': stdout, 'cmd': cmds})
    else:
        rval.update({'stderr': stderr, 'stdout': stdout, 'results': {}})
    return rval
