def to_match_vid(value, ofpvid_present):
    # NOTE: If "vlan_id" field is described as decimal int value
    #       (and decimal string value), it is treated as values of
    #       VLAN tag, and OFPVID_PRESENT(0x1000) bit is automatically
    #       applied. OTOH, If it is described as hexadecimal string,
    #       treated as values of oxm_value (including OFPVID_PRESENT
    #       bit), and OFPVID_PRESENT bit is NOT automatically applied
    if isinstance(value, six.integer_types):
        # described as decimal int value
        return value | ofpvid_present

    else:
        if '/' in value:
            val = value.split('/')
            return int(val[0], 0), int(val[1], 0)

        else:
            if value.isdigit():
                # described as decimal string value
                return int(value, 10) | ofpvid_present

            return int(value, 0)
dataset/ETHPy150Open osrg/ryu/ryu/lib/ofctl_utils.py/to_match_vid/original