code: def get_checksums(path, algorithms):
      
      if not algorithms:
          return {}
  
      compute_md5 = 'md5' in algorithms
      compute_sha256 = 'sha256' in algorithms
  
      if compute_md5:
          md5 = hashlib.md5()
      if compute_sha256:
          sha256 = hashlib.sha256()
      blocksize = 65536
      with open(path, mode='rb') as f:
          buf = f.read(blocksize)
          while len(buf) > 0:
              if compute_md5:
                  md5.update(buf)
              if compute_sha256:
                  sha256.update(buf)
              buf = f.read(blocksize)
  
      checksums = {}
      if compute_md5:
          checksums['md5sum'] = md5.hexdigest()
          logger.debug('md5sum: %s', checksums['md5sum'])
      if compute_sha256:
          checksums['sha256sum'] = sha256.hexdigest()
          logger.debug('sha256sum: %s', checksums['sha256sum'])
      return checksums
docs: Compute a checksum(s) of given file using specified algorithms.
  
      :param path: path to file
      :param algorithms: list of cryptographic hash functions, currently supported: md5, sha256
      :return: dictionary