source.rstrip(given) will use each character of the given string and strip the source from right.
'uniform.ma'.rstrip('.ma') # will strip ., m, a individually so you are left with unifor
>>> 'unifor'
'outfit.ma'.rstrip('.ma')
>>> 'outfit'
'mama.ma'.rstrip('.ma') # will strip ., m, a individually which leaves you nothing
>>> ''