def _bind_by_name(self, socket, name):
    if (not (name.startswith('urn:nfc:sn') or name.startswith('urn:nfc:xsn') or (name == 'com.android.npp'))):
        raise Error(errno.EFAULT)
    with self.lock:
        if (self.snl.get(name) != None):
            raise Error(errno.EADDRINUSE)
        addr = wks_map.get(name)
        if (addr is None):
            try:
                addr = (16 + self.sap[16:32].index(None))
            except ValueError:
                raise Error(errno.EADDRNOTAVAIL)
        socket.bind(addr)
        self.sap[addr] = ServiceAccessPoint(addr, self)
        self.sap[addr].insert_socket(socket)
        self.snl[name] = addr
def _bind_by_name(self, socket, name):
    if (not (name.startswith('urn:nfc:sn') or name.startswith('urn:nfc:xsn') or (name == 'com.android.npp'))):
        raise Error(errno.EFAULT)
    with self.lock:
        if (self.snl.get(name) != None):
            raise Error(errno.EADDRINUSE)
        addr = wks_map.get(name)
        if (addr is None):
            try:
                addr = (16 + self.sap[16:32].index(None))
            except ValueError:
                raise Error(errno.EADDRNOTAVAIL)
        socket.bind(addr)
        self.sap[addr] = ServiceAccessPoint(addr, self)
        self.sap[addr].insert_socket(socket)
        self.snl[name] = addr