from typing import Optional


def cast_int(number: str) -> Optional[int]:
    """Try casting given string as int."""
    try:
        result = int(number)
    except ValueError:
        result = None
    return result