def int_or_none(n):
    """Returns input n cast as int, or None if input is none.

    This is used in parsing sample information from image filenames.

    Parameters
    ----------
    n : any value castable as int, None
        The input value.

    Returns
    -------
    The input value cast an int, or None.

    Examples
    --------
    >>> int_or_none(3.0)
    3
    >>> int_or_none(None)
    """
    return int(n) if n is not None else None