def step_4(w):
 for (suffix, rules) in suffixes4:
  if w.endswith(suffix):
   for A in rules:
    if w.endswith(A):
     return ((R2(w).endswith(A) and w[:(- len(A))]) or w)
 if (R2(w).endswith('ion') and w[:(-3)].endswith(('s', 't'))):
  return w[:(-3)]
 return w

def step_4 ( w ) : for ( suffix , rules ) in suffixes4 : if w . endswith ( suffix ) : for A in rules : if w . endswith ( A ) : return ( ( R2 ( w ) . endswith ( A ) and w [ : ( - len ( A ) ) ] ) or w ) if ( R2 ( w ) . endswith ( 'ion' ) and w [ : ( - 3 ) ] . endswith ( ( 's' , 't' ) ) ) : return w [ : ( - 3 ) ] return w
step 4 strips -ant .