Sorry for a late and somewhat nitpicky comment, but a nested `if` statement would seem more logical (and faster):
```
elif len(sep) == 1:
    if fields == 1:
        ...
    elif fields == 2:
        ...
    else:
        ...
```
and then also move the check that `1 <= fields <= 3` so that we know that fields is correct here.