import hashlib


def checksum(filename):
    """Get file checksum.

    Keyword arguments:
    filename -- input filename

    :param filename: str
    :return md5sum: str
    """
    data = open(filename, "rb")
    md5sum = hashlib.md5()
    # Loop over chunks of the file so we don't read it all into memory
    for chunk in iter(lambda: data.read(4096), b""):
        # Update the checksum with each chunk
        md5sum.update(chunk)

    return md5sum.hexdigest()