Currently, I'd probably program my intention like this. Let's assume this is something where the '=' is allowed in the middle.
Getting increasingly hypothetical...
Anyway, you could write:
```
assert not salt.endswith("=" * 3) # at most 2 ='s allowed
salt = salt.rstrip("=")
```