import hashlib


def compute_md5_hash(file, buf_size=65536):
    """Utility method to generate a md5 hash of file."""
    md5_hash = hashlib.md5()
    while True:
        data = file.read(buf_size)
        if not data:
            break
        md5_hash.update(data)

    return md5_hash.hexdigest()