def file_md5(fpath: Union[str, Path], chunk_size: int = 2 ** 16) -> Optional[str]:
    """Return md5 hash value for file contents.

    Args:
        fpath: Path to file.
        chunk_size: md5 object updated by ``chunk_size`` bytes from file.

    Returns:
        None if ``fpath`` does not point to a file, else returns md5 hash value as string.

    """
    fpath = Path(fpath)
    if not fpath.is_file():
        return None
    file_hash = md5()
    with fpath.open('rb') as f:
        for chunk in iter(lambda: f.read(chunk_size), b""):
            file_hash.update(chunk)
    return file_hash.hexdigest()
Return md5 hash value for file contents.

    Args:
        fpath: Path to file.
        chunk_size: md5 object updated by ``chunk_size`` bytes from file.

    Returns:
        None if ``fpath`` does not point to a file, else returns md5 hash value as string.

    
deeppavlov/core/data/utils.py