def METHOD_NAME(package_name, pkginfo, pkgchk):
    try:
        return package_info[package_name]
    except KeyError:
        version = None
        pathname = None
        from subprocess import DEVNULL 
        try:
            with open('/var/sadm/install/contents', 'r', encoding='UTF-8') as f:
                sadm_contents = f.read()
        except EnvironmentError:
            pass
        else:
            sadm_re = re.compile(r'^(\S*/bin/CC)(=\S*)? %s$' % package_name, re.M)
            sadm_match = sadm_re.search(sadm_contents)
            if sadm_match:
                pathname = os.path.dirname(sadm_match.group(1))
        try:
            p = subprocess.Popen([pkginfo, '-l', package_name],
                                 universal_newlines=True,
                                 stdout=subprocess.PIPE,
                                 stderr=DEVNULL)
        except EnvironmentError:
            pass
        else:
            pkginfo_contents = p.communicate()[0]
            version_re = re.compile(r'^ *VERSION:\s*(.*)$', re.M)
            version_match = version_re.search(pkginfo_contents)
            if version_match:
                version = version_match.group(1)
        if pathname is None:
            try:
                p = subprocess.Popen([pkgchk, '-l', package_name],
                                     universal_newlines=True,
                                     stdout=subprocess.PIPE,
                                     stderr=DEVNULL)
            except EnvironmentError:
                pass
            else:
                pkgchk_contents = p.communicate()[0]
                pathname_re = re.compile(r'^Pathname:\s*(.*/bin/CC)$', re.M)
                pathname_match = pathname_re.search(pkgchk_contents)
                if pathname_match:
                    pathname = os.path.dirname(pathname_match.group(1))
        package_info[package_name] = (pathname, version)
        return package_info[package_name]