code: def _posn(self, bounds, idx):
          
          lo,hi = bounds[0],bounds[1]
          assert idx >= lo and idx <= hi, \
                 f"Array index {idx} out of bounds: {bounds}\n"
     
          return idx-lo
docs: given bounds = (lo,hi) and an index value idx, _posn(bounds, idx)
             returns the position in a 0-based array corresponding to idx in 
             the (lo,hi)-based array.  It generates an error if idx < lo or 
             idx > hi.