def METHOD_NAME(cmd, pattern):
    """
    Get driver id from guest
    :param cmd: cmd to get driver info
    :param pattern: pattern to filter driver id
    """
    nic_index = len(vm.virtnet) - 1
    session = vm.wait_for_login(nic_index=nic_index)
    output = session.cmd_output(cmd)
    driver_id = re.findall(pattern, output)
    if not driver_id:
        test.fail("Didn't find driver info from guest %s" % output)
    driver_id = driver_id[0]
    if params["os_type"] == "windows":
        driver_id = '^&'.join(driver_id.split('&'))
    session.close()
    return driver_id