def read_option_value_from_nibble(nibble, pos, values):
        """
        Calculates the value used in the extended option fields.

        :param nibble: the 4-bit option header value.
        :return: the value calculated from the nibble and the extended option value.
        """
        if nibble <= 12:
            return nibble, pos
        elif nibble == 13:
            tmp = struct.unpack("!B", values[pos].to_bytes(1, "big"))[0] + 13
            pos += 1
            return tmp, pos
        elif nibble == 14:
            s = struct.Struct("!H")
            tmp = s.unpack_from(values[pos:].to_bytes(2, "big"))[0] + 269
            pos += 2
            return tmp, pos
        else:
            raise AttributeError("Unsupported option nibble " + str(nibble))
def read_option_value_from_nibble ( nibble , pos , values ) : if nibble <= 12 : return nibble , pos elif nibble == 13 : tmp = struct . unpack ( "!B" , values [ pos ] . to_bytes ( 1 , "big" ) ) [ 0 ] + 13 pos += 1 return tmp , pos elif nibble == 14 : s = struct . Struct ( "!H" ) tmp = s . unpack_from ( values [ pos : ] . to_bytes ( 2 , "big" ) ) [ 0 ] + 269 pos += 2 return tmp , pos else : raise AttributeError ( "Unsupported option nibble " + str ( nibble ) )
Calculates the value used in the extended option fields.

        :param nibble: the 4-bit option header value.
        :return: the value calculated from the nibble and the extended option value.