def METHOD_NAME(flags, mapping_name, mapping_from, mapping_to, host_os, virt_os):
    ret = 0
    for n in mapping_name:
        if mapping_from[n] is None or mapping_to[n] is None:
            continue
        if (flags & mapping_from[n]) == mapping_from[n]:
            ret = ret | mapping_to[n]
        if (host_os == QL_OS.WINDOWS and virt_os != QL_OS.WINDOWS):
            ret = ret | mapping_to['O_BINARY']
    return ret