from typing import Union
from typing import Optional


def try_str_int(value: str) -> Union[str, int]:
    """Try to convert str to int and return int or original str."""
    converted: Optional[int] = None
    try:
        converted = int(value)
    except ValueError:
        pass
    return value if converted is None else converted