import hashlib


def md5checksum(afilepath):
    """ md5checksum

        Calculates the MD5 checksum for afilepath
    """
    with open(afilepath, 'rb') as filehandler:
        calc_md5 = hashlib.md5()
        while True:
            data = filehandler.read(8192)
            if not data:
                break
            calc_md5.update(data)
        return calc_md5.hexdigest()