def step_1b(w):
 if (w.endswith('y') and w.endswith(('edly', 'ingly'))):
  w = w[:(-2)]
 if w.endswith(('ed', 'ing')):
  if w.endswith('ied'):
   return (((len(w) == 4) and w[:(-1)]) or w[:(-2)])
  if w.endswith('eed'):
   return ((R1(w).endswith('eed') and w[:(-1)]) or w)
  for suffix in ('ed', 'ing'):
   if (w.endswith(suffix) and has_vowel(w[:(- len(suffix))])):
    w = w[:(- len(suffix))]
    if w.endswith(('at', 'bl', 'iz')):
     return (w + 'e')
    if is_double_consonant(w[(-2):]):
     return w[:(-1)]
    if is_short(w):
     return (w + 'e')
 return w

def step_1b ( w ) : if ( w . endswith ( 'y' ) and w . endswith ( ( 'edly' , 'ingly' ) ) ) : w = w [ : ( - 2 ) ] if w . endswith ( ( 'ed' , 'ing' ) ) : if w . endswith ( 'ied' ) : return ( ( ( len ( w ) == 4 ) and w [ : ( - 1 ) ] ) or w [ : ( - 2 ) ] ) if w . endswith ( 'eed' ) : return ( ( R1 ( w ) . endswith ( 'eed' ) and w [ : ( - 1 ) ] ) or w ) for suffix in ( 'ed' , 'ing' ) : if ( w . endswith ( suffix ) and has_vowel ( w [ : ( - len ( suffix ) ) ] ) ) : w = w [ : ( - len ( suffix ) ) ] if w . endswith ( ( 'at' , 'bl' , 'iz' ) ) : return ( w + 'e' ) if is_double_consonant ( w [ ( - 2 ) : ] ) : return w [ : ( - 1 ) ] if is_short ( w ) : return ( w + 'e' ) return w
step 1b handles -ed and -ing suffixes .