from typing import Optional


def try_int(s: str) -> Optional[int]:
    """Convert string to int if possible. Else return None."""
    try:
        return int(s)
    except ValueError:
        return None