code: def _norm_slice(sl, start, stop):
      
      length = stop - start
      if sl.start is None:
          normstart = 0
      else:
          if sl.start < 0:
              if sl.start < -length:
                  normstart = 0
              else:
                  normstart = sl.start + length
          else:
              if sl.start > stop:
                  normstart = length
              else:
                  normstart = sl.start - start
      if sl.stop is None:
          normstop = length
      else:
          if sl.stop < 0:
              if sl.stop < -length:
                  normstop = 0
              else:
                  normstop = sl.stop + length
          else:
              if sl.stop > stop:
                  normstop = length
              else:
                  normstop = sl.stop - start
      if normstop < normstart:
          normstop = normstart
      return slice(normstart, normstop)
docs: Return a slice normalized to an farray start index.