```python
'/foo/'.rstrip(os.path.sep)
'/foo'
```