code: def cdx_resolve_revisits(cdx_iter):
      
      originals = {}
  
      for cdx in cdx_iter:
          is_revisit = cdx.is_revisit()
  
          digest = cdx.get(DIGEST)
  
          original_cdx = None
  
          # only set if digest is valid, otherwise no way to resolve
          if digest:
              original_cdx = originals.get(digest)
  
              if not original_cdx and not is_revisit:
                  originals[digest] = cdx
  
          if original_cdx and is_revisit:
              fill_orig = lambda field: original_cdx.get(field, '-')
              # Transfer mimetype and statuscode
              if MIMETYPE in cdx:
                  cdx[MIMETYPE] = original_cdx.get(MIMETYPE, '')
              if STATUSCODE in cdx:
                  cdx[STATUSCODE] = original_cdx.get(STATUSCODE, '')
          else:
              fill_orig = lambda field: '-'
  
          # Always add either the original or empty '- - -'
          for field in ORIG_TUPLE:
              cdx['orig.' + field] = fill_orig(field)
  
          yield cdx
docs: resolve revisits.
  
      this filter adds three fields to CDX: ``orig.length``, ``orig.offset``,
      and ``orig.filename``. for revisit records, these fields have corresponding
      field values in previous non-revisit (original) CDX record.
      They are all ``"-"`` for non-revisit records.