code: def remove_trailing(needle, haystack):
      
      if haystack[-len(needle):] == needle:
          return haystack[:-len(needle)]
      return haystack
docs: Remove trailing needle string (if exists).
  
      >>> remove_trailing('Test', 'ThisAndThatTest')
      'ThisAndThat'
      >>> remove_trailing('Test', 'ArbitraryName')
      'ArbitraryName'