def int_or_none(var):
    """
    Trys to convert 'var' into an integer. Returns None if an TypeError occures.
    """
    try:
        return int(var)
    except (TypeError, ValueError):
        return None