def remove_suffix(string, suffix):
 if (suffix and string.endswith(suffix)):
  return string[:(- len(suffix))]
 else:
  return string

def remove_suffix ( string , suffix ) : if ( suffix and string . endswith ( suffix ) ) : return string [ : ( - len ( suffix ) ) ] else : return string
this function removes the given suffix from a string .