def rtrimTerminus(command, terminator=None):
 if terminator:
  pieces = command.split(terminator)
  if (len(pieces) > 1):
   command = (terminator.join(pieces[:(-1)]) + terminator)
 return command

def rtrimTerminus ( command , terminator = None ) : if terminator : pieces = command . split ( terminator ) if ( len ( pieces ) > 1 ) : command = ( terminator . join ( pieces [ : ( - 1 ) ] ) + terminator ) return command
return command minus anything that follows the final terminator .