def METHOD_NAME(session, os_type, cpuinfo):
    """
    check the cpu topology of the guest.
    :param session: session Object
    :param os_type: guest os type, windows or linux
    :param cpuinfo: virt_vm.CpuInfo Object
    :return: True if guest topology is same as we expected
    """
    if os_type == "linux":
        out = session.cmd_output_safe("lscpu")
        cpu_info = dict(re.findall(r"([A-Z].+):\s+(.+)", out, re.M))
        sockets = int(cpu_info["Socket(s)"])
        cores = int(cpu_info["Core(s) per socket"])
        threads = int(cpu_info["Thread(s) per core"])
    else:
        cmd = ('powershell "Get-WmiObject Win32_processor | Format-List '
               'NumberOfCores,ThreadCount"')
        out = session.cmd_output_safe(cmd).strip()
        try:
            cpu_info = [dict(re.findall(r"(\w+)\s+:\s(\d+)", cpu_out, re.M))
                        for cpu_out in out.split("\n\n")]
            sockets = len(cpu_info)
            cores = int(cpu_info[0]["NumberOfCores"])
            threads = int(cpu_info[0]["ThreadCount"])
        except KeyError:
            LOG_JOB.warning("Attempt to get output via 'powershell' failed, "
                            "output returned by guest:\n%s", out)
            LOG_JOB.info("Try again via 'wmic'")
            cmd = 'wmic CPU get NumberOfCores,ThreadCount /Format:list'
            out = session.cmd_output_safe(cmd).strip()
            try:
                cpu_info = [dict(re.findall(r"(\w+)=(\d+)", cpu_out, re.M))
                            for cpu_out in out.split("\n\n")]
                sockets = len(cpu_info)
                cores = int(cpu_info[0]["NumberOfCores"])
                threads = int(cpu_info[0]["ThreadCount"])
            except KeyError:
                LOG_JOB.error("Attempt to get output via 'wmic' failed, output"
                              " returned by guest:\n%s", out)
                return False
    is_matched = (cpuinfo.sockets == sockets and cpuinfo.cores == cores and
                  cpuinfo.threads == threads)
    if not is_matched:
        LOG_JOB.debug("CPU infomation of guest:\n%s", out)
    return is_matched