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):
  filenameIndex = (sepIndex + 1)
  while (filenameIndex < dotIndex):
   if (p[filenameIndex] != extsep):
    return (p[:dotIndex], p[dotIndex:])
   filenameIndex += 1
 return (p, '')

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 ) : filenameIndex = ( sepIndex + 1 ) while ( filenameIndex < dotIndex ) : if ( p [ filenameIndex ] != extsep ) : return ( p [ : dotIndex ] , p [ dotIndex : ] ) filenameIndex += 1 return ( p , '' )
split the extension from a pathname .