code: def memorySearch(self, ip):
          
          if not ip.isdigit(): ip = self.ip2Long(ip)
  
          if self.__dbBinStr == '':
              self.__dbBinStr = self.__f.read() #read all the contents in file
              self.__sPtr     = self.getLong(self.__dbBinStr, 0)
              endPtr          = self.getLong(self.__dbBinStr, 4)
              self.__indexLen = endPtr - self.__sPtr
  
          startPtr = self.__sPtr
          indexLen = self.__indexLen
          dbBinStr = self.__dbBinStr
  
          l, h, mixPtr = (0, int(indexLen/12), 0)
          while l <= h:
              m   = int((l+h)/2)
              ptr = startPtr + m*12
  
              sip = self.getLong(dbBinStr, ptr)
              eip = self.getLong(dbBinStr, ptr+4)
  
              if ip >= sip:
                  if ip > eip:
                      l = m + 1
                  else:
                      mixPtr = self.getLong(dbBinStr, ptr+8)
                      break;
              else:
                  h = m - 1
  
          if mixPtr == 0: return "N2"
  
          return self.returnData(mixPtr)
docs: " memory search method
          " param: ip