import hashlib


def get_md5_hash(source_dir, chunksize=8192):
    """Generate MD5 hash of package file."""

    with open(source_dir, "rb") as f:
        file_hash = hashlib.md5()
        chunk = f.read(chunksize)
        while chunk:
            file_hash.update(chunk)
            chunk = f.read(chunksize)
    return file_hash.hexdigest()