code: def trim_baseline_of_removed_secrets(results, baseline, filelist):
      
      updated = False
      for filename in filelist:
          if filename not in baseline.data:
              # Nothing to modify, because not even there in the first place.
              continue
  
          if filename not in results.data:
              # All secrets relating to that file was removed.
              # We know this because:
              #   1. It's a file that was scanned (in filelist)
              #   2. It was in the baseline
              #   3. It has no results now.
              del baseline.data[filename]
              updated = True
              continue
  
          # We clone the baseline, so that we can modify the baseline,
          # without messing up the iteration.
          for baseline_secret in baseline.data[filename].copy():
              new_secret_found = results.get_secret(
                  filename,
                  baseline_secret.secret_hash,
                  baseline_secret.type,
              )
  
              if not new_secret_found:
                  # No longer in results, so can remove from baseline
                  old_secret_to_delete = baseline.get_secret(
                      filename,
                      baseline_secret.secret_hash,
                      baseline_secret.type,
                  )
                  del baseline.data[filename][old_secret_to_delete]
                  updated = True
  
              elif new_secret_found.lineno != baseline_secret.lineno:
                  # Secret moved around, should update baseline with new location
                  old_secret_to_update = baseline.get_secret(
                      filename,
                      baseline_secret.secret_hash,
                      baseline_secret.type,
                  )
                  old_secret_to_update.lineno = new_secret_found.lineno
                  updated = True
  
      return updated
docs: NOTE: filelist is not a comprehensive list of all files in the repo
      (because we can't be sure whether --all-files is passed in as a
      parameter to pre-commit).
  
      :type results: SecretsCollection
      :type baseline: SecretsCollection
  
      :type filelist: list(str)
      :param filelist: filenames that are scanned.
  
      :rtype: bool
      :returns: True if baseline was updated