code: def md5sum(filename, blocksize=8192):
          
          with open(filename, 'rb') as fh:
              m = hashlib.md5()
              while True:
                  data = fh.read(blocksize)
                  if not data:
                      break
                  m.update(data)
          return m.hexdigest()
docs: Get the MD5 checksum of a file.