from typing import Union
from pathlib import Path


def is_valid_file(filepath: Union[str, Path, None]) -> bool:
    """check if the passed filepath points to a real file"""
    if filepath is None:
        return False
    return Path(filepath).exists()