def _request_session(self, remote_type, local_type, timeout=None):
    p = NetBIOSSessionPacket()
    remote_name = encode_name(self.get_remote_name(), remote_type, '')
    myname = encode_name(self.get_myname(), local_type, '')
    p.set_type(NETBIOS_SESSION_REQUEST)
    p.set_trailer((remote_name + myname))
    self._sock.send(p.rawData())
    while 1:
        p = self.recv_packet(timeout)
        if (p.get_type() == NETBIOS_SESSION_NEGATIVE_RESPONSE):
            raise NetBIOSError('Cannot request session', ERRCLASS_SESSION, ord(p.get_trailer()[0]))
        elif (p.get_type() == NETBIOS_SESSION_POSITIVE_RESPONSE):
            break
        else:
            pass
def _request_session(self, remote_type, local_type, timeout=None):
    p = NetBIOSSessionPacket()
    remote_name = encode_name(self.get_remote_name(), remote_type, )
    myname = encode_name(self.get_myname(), local_type, )
    p.set_type(NETBIOS_SESSION_REQUEST)
    p.set_trailer((remote_name + myname))
    self._sock.send(p.rawData())
    while 1:
        p = self.recv_packet(timeout)
        if (p.get_type() == NETBIOS_SESSION_NEGATIVE_RESPONSE):
            raise NetBIOSError('Cannot request session', ERRCLASS_SESSION, ord(p.get_trailer()[0]))
        elif (p.get_type() == NETBIOS_SESSION_POSITIVE_RESPONSE):
            break
        else:
            pass