import logging
import hashlib


def calc_md5(infile, block_size=256*128):
    """Calculate the md5sum of a file

    Args:
        infile (str): input file
        block_size (int): block_size for the file chunks. Default = 256*128

    Returns:
        str: md5 sum of the inout file
    """
    logger = logging.getLogger(__name__)
    logger.info(f'Calculating md5 of {infile}')
    md5 = hashlib.md5()
    with open(infile, 'rb') as f:
        for chunk in iter(lambda: f.read(block_size), b''):
            md5.update(chunk)
    return md5.hexdigest()