'Check if package [name] is installed.
:param name: Package name.
:param version: Package version.
:param arch: Package architecture.'

def check_installed(self, name, version=None, arch=None):

    if arch:
        cmd = (((self.lowlevel_base_cmd + '    -q    --qf    %{ARCH}    ') + name) + '    2>    /dev/null')
        inst_archs = utils.system_output(cmd, ignore_status=True)
        inst_archs = inst_archs.split('\n')
        for inst_arch in inst_archs:
            if (inst_arch == arch):
                return self._check_installed_version(name, version)
        return False
    elif version:
        return self._check_installed_version(name, version)
    else:
        cmd = (('rpm    -q    ' + name) + '    2>    /dev/null')
        try:
            utils.system(cmd)
            return True
        except error.CmdError:
            return False
