

def is_installed(pkg_name):
    '\n    Check if a Portage package is installed.\n    '
    manager = MANAGER
    with settings(hide('running', 'stdout', 'stderr', 'warnings'), warn_only=True):
        res = run(('%(manager)s -p %(pkg_name)s' % locals()))
    if (not res.succeeded):
        return False
    if pkg_name.startswith('='):
        pkg_name = pkg_name[1:]
    match = re.search(('\\n\\[ebuild +(?P<code>\\w+) *\\] .*%(pkg_name)s.*' % locals()), match.stdout)
    if (match and (match.groupdict()['code'] in ('U', 'R'))):
        return True
    else:
        return False

dataset/ETHPy150Open ronnix/fabtools/fabtools/portage.py is_installed/VarMisuse@98/185 `res`->`match`