from typing import Any
from typing import Type


def none_checker(val: Any, dtype: Type) -> Any:
    """Check given argument for None.

    Args:
        val: model arguments passed to the configuration.
        dtype: expected argument type.

    Returns:
        Value casted in the expected type or None.
    """
    if not val or val == "none":
        return None
    return dtype(val)