def __init__(self, data=0):
    self.type = 0
    self.flags = 0
    self.length = 0
    if (data == 0):
        self._trailer = ''
    else:
        try:
            self.type = ord(data[0])
            if (self.type == NETBIOS_SESSION_MESSAGE):
                self.length = ((ord(data[1]) << 16) | unpack('!H', data[2:4])[0])
            else:
                self.flags = ord(data[1])
                self.length = unpack('!H', data[2:4])[0]
            self._trailer = data[4:]
        except:
            raise NetBIOSError('Wrong packet format ')
def __init__(self, data=0):
    self.type = 0
    self.flags = 0
    self.length = 0
    if (data == 0):
        self._trailer = 
    else:
        try:
            self.type = ord(data[0])
            if (self.type == NETBIOS_SESSION_MESSAGE):
                self.length = ((ord(data[1]) << 16) | unpack('!H', data[2:4])[0])
            else:
                self.flags = ord(data[1])
                self.length = unpack('!H', data[2:4])[0]
            self._trailer = data[4:]
        except:
            raise NetBIOSError('Wrong packet format ')