def METHOD_NAME(self):
    if self.type == 'string<packet>':
        return self.value.get_packet_string()
    if self.type in ['string<EOF>', 'byte<EOF>']:
        length = int(len(self.value))
        self.var_len = length
        if length == 0:
            return b''
        else:
            return struct.pack('{len}s'.format(len=self.var_len), bytes(self.value, 'utf-8'))[:length]
    if self.type == 'string<NUL>':
        return bytes(self.value, 'utf-8') + struct.pack('b', 0)
    if self.var_len.isdigit():
        length = int(self.var_len)
        if self.var_type == 'int':
            # little endian format
            return struct.pack('Q', self.value)[:length]
        if self.var_type == 'string':
            return struct.pack(self.var_len + 's', bytes(self.value, 'utf-8'))[:length]
        if self.var_type == 'byte':
            return struct.pack(self.var_len + 's', self.value)[:length]
    elif self.var_len == 'lenenc':
        if self.value is None:
            return NULL_VALUE
        if self.var_type == 'int':
            return self.lenencInt(self.value)
        if self.var_type in ['byte', 'string']:
            value = self.value.decode() if isinstance(self.value, bytes) else self.value
            if isinstance(value, str) is False and value is not None:
                value = str(value)
            val_len = len(value.encode('utf8'))
            byte_count = int(math.ceil(math.log((val_len + 1), 2) / 8))
            if val_len < NULL_VALUE[0]:
                return self.lenencInt(val_len) + bytes(value, 'utf-8')
            if val_len >= NULL_VALUE[0] and byte_count <= 2:
                return TWO_BYTE_ENC + struct.pack('i', val_len)[:2] + bytes(value, 'utf-8')
            if byte_count <= 3:
                return THREE_BYTE_ENC + struct.pack('i', val_len)[:3] + bytes(value, 'utf-8')
            if byte_count <= 8:
                return THREE_BYTE_ENC + struct.pack('Q', val_len)[:8] + bytes(value, 'utf-8')