def _strips(direction, text, remove):
 if (direction == 'l'):
  if text.startswith(remove):
   return text[len(remove):]
 elif (direction == 'r'):
  if text.endswith(remove):
   return text[:(- len(remove))]
 else:
  raise WrongDirection, 'Needs to be r or l.'
 return text

def _strips ( direction , text , remove ) : if ( direction == 'l' ) : if text . startswith ( remove ) : return text [ len ( remove ) : ] elif ( direction == 'r' ) : if text . endswith ( remove ) : return text [ : ( - len ( remove ) ) ] else : raise WrongDirection , 'Needs to be r or l.' return text
strips remove from text at direction end .