from pathlib import Path
import hashlib


def create_hash(fname: Path) -> str:
    """Return MD5 hash of the passed file contents.

    :param fname:  Path, path to file for hashing

    We can ignore the Bandit B303 error as we're not using the hash for
    cryptographic purposes.
    """
    hash_md5 = hashlib.md5()  # nosec
    with open(fname, "rb") as fhandle:
        for chunk in iter(lambda: fhandle.read(65536), b""):
            hash_md5.update(chunk)
    return hash_md5.hexdigest()