I tried to change it to:

```Python
end = len(filename) - len(suffix)
assert end >= 0
filename = filename[:end]
```

But translation still fails. Any suggestion?