code: def _norm_index(dim, index, start, stop):
      
      length = stop - start
      if -length <= index < 0:
          normindex = index + length
      elif start <= index < stop:
          normindex = index - start
      else:
          fstr = "expected dim {} index in range [{}, {})"
          raise IndexError(fstr.format(dim, start, stop))
      return normindex
docs: Return an index normalized to an farray start index.