human
remove a substring from the end of a string
assistant
Here is some code to remove a substring `suffix` from the end of string `text`

if (not text.endswith(suffix)):
    return text
return text[:(len(text) - len(suffix))]

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.