One trick you could use for this is something like the following for converting the string to int. Basically this just fallsback to returning a unique object instance that will never be equal to anything but the exact same instance.

```
def _convert_to_int(string):
    try:
        return int(string)
    except TypeError:
        return object()
```