code: def _splitext(p, sep, altsep, extsep):
      
  
      sepIndex = p.rfind(sep)
      if altsep:
          altsepIndex = p.rfind(altsep)
          sepIndex = max(sepIndex, altsepIndex)
  
      dotIndex = p.rfind(extsep)
      if dotIndex > sepIndex:
          # skip all leading dots
          filenameIndex = sepIndex + 1
          while filenameIndex < dotIndex:
              if p[filenameIndex] != extsep:
                  return p[:dotIndex], p[dotIndex:]
              filenameIndex += 1
  
      return p, ''
docs: Split the extension from a pathname.
  
      Extension is everything from the last dot to the end, ignoring
      leading dots.  Returns "(root, ext)"; ext may be empty.