def get_option_flags(option_num):
        """
        Get Critical, UnSafe, NoCacheKey flags from the option number
        as per RFC 7252, section 5.4.6

        :param option_num: option number
        :return: option flags
        :rtype: 3-tuple (critical, unsafe, no-cache)
        """
        opt_bytes = array.array('B', '\0\0')
        if option_num < 256:
            s = struct.Struct("!B")
            s.pack_into(opt_bytes, 0, option_num)
        else:
            s = struct.Struct("H")
            s.pack_into(opt_bytes, 0, option_num)
        critical = (opt_bytes[0] & 0x01) > 0
        unsafe = (opt_bytes[0] & 0x02) > 0
        nocache = ((opt_bytes[0] & 0x1e) == 0x1c)
        return (critical, unsafe, nocache)
def get_option_flags ( option_num ) : opt_bytes = array . array ( 'B' , '\0\0' ) if option_num < 256 : s = struct . Struct ( "!B" ) s . pack_into ( opt_bytes , 0 , option_num ) else : s = struct . Struct ( "H" ) s . pack_into ( opt_bytes , 0 , option_num ) critical = ( opt_bytes [ 0 ] & 0x01 ) > 0 unsafe = ( opt_bytes [ 0 ] & 0x02 ) > 0 nocache = ( ( opt_bytes [ 0 ] & 0x1e ) == 0x1c ) return ( critical , unsafe , nocache )
Get Critical, UnSafe, NoCacheKey flags from the option number
        as per RFC 7252, section 5.4.6

        :param option_num: option number
        :return: option flags
        :rtype: 3-tuple (critical, unsafe, no-cache)