old_contents: import array 
  import numpy 
  
  class IdIndexer(object): 
      def __init__(self, arrayType="i"): 
          self.inds = array.array(arrayType)
          
          self.idSet = set([])
          self.idDict = {}
          self.p = 0 
          
      def append(self, id): 
          if id not in self.idSet: 
              self.idSet.add(id)
              self.idDict[id] = self.p
              ind = self.p 
              self.p += 1 
          else: 
              ind = self.idDict[id]   
              
          self.inds.append(ind)
          
      def getArray(self): 
          return numpy.array(self.inds)
          
      def getIdDict(self): 
          return self.idDict
new_contents: import array 
  import numpy 
  
  class IdIndexer(object): 
      def __init__(self, arrayType="i"): 
          self.inds = array.array(arrayType)
          
          self.idSet = set([])
          self.idDict = {}
          self.p = 0 
          
      def append(self, id): 
          if id not in self.idSet: 
              self.idSet.add(id)
              self.idDict[id] = self.p
              ind = self.p 
              self.p += 1 
          else: 
              ind = self.idDict[id]   
              
          self.inds.append(ind)
          return ind 
          
      def getArray(self): 
          return numpy.array(self.inds)
          
      def getIdDict(self): 
          return self.idDict
subject: Return index