["python","string"]
Remove substring only at the end of string

I have a bunch of strings, some of them have ' rec'. I want to remove that only if those are the last 4 characters. So in other words I have somestring = 'this is some string rec' and I want it to become somestring = 'this is some string' What is the Python way to approach this?
def rchop(s, suffix): if suffix and s.endswith(suffix): return s[:-len(suffix)] return s somestring = 'this is some string rec' rchop(somestring, ' rec') # returns 'this is some string'