def __init__(self, data=0):
    self.name_trn_id = 0
    self.opcode = 0
    self.nm_flags = 0
    self.rcode = 0
    self.qdcount = 0
    self.ancount = 0
    self.nscount = 0
    self.arcount = 0
    self.questions = ''
    self.answers = ''
    if (data == 0):
        self._data = ''
    else:
        try:
            self._data = data
            self.opcode = (ord(data[2]) >> 3)
            self.nm_flags = (((ord(data[2]) & 3) << 4) | ((ord(data[3]) & 240) >> 4))
            self.name_trn_id = unpack('>H', self._data[:2])[0]
            self.rcode = (ord(data[3]) & 15)
            self.qdcount = unpack('>H', self._data[4:6])[0]
            self.ancount = unpack('>H', self._data[6:8])[0]
            self.nscount = unpack('>H', self._data[8:10])[0]
            self.arcount = unpack('>H', self._data[10:12])[0]
            self.answers = self._data[12:]
        except Exception:
            raise NetBIOSError('Wrong packet format ')
def __init__(self, data=0):
    self.name_trn_id = 0
    self.opcode = 0
    self.nm_flags = 0
    self.rcode = 0
    self.qdcount = 0
    self.ancount = 0
    self.nscount = 0
    self.arcount = 0
    self.questions = 
    self.answers = 
    if (data == 0):
        self._data = 
    else:
        try:
            self._data = data
            self.opcode = (ord(data[2]) >> 3)
            self.nm_flags = (((ord(data[2]) & 3) << 4) | ((ord(data[3]) & 240) >> 4))
            self.name_trn_id = unpack('>H', self._data[:2])[0]
            self.rcode = (ord(data[3]) & 15)
            self.qdcount = unpack('>H', self._data[4:6])[0]
            self.ancount = unpack('>H', self._data[6:8])[0]
            self.nscount = unpack('>H', self._data[8:10])[0]
            self.arcount = unpack('>H', self._data[10:12])[0]
            self.answers = self._data[12:]
        except Exception:
            raise NetBIOSError('Wrong packet format ')