code: def _merge_on_matching(self, uuid, matcher, verbose):
          
  
          matches = api.match_identities(self.db, uuid, matcher)
  
          new_uuid = uuid
  
          u = api.unique_identities(self.db, uuid)[0]
  
          for m in matches:
              if m.uuid == uuid:
                  continue
  
              self._merge(u, m, verbose)
  
              new_uuid = m.uuid
  
              # Swap uids to merge with those that could
              # remain on the list with updated info
              u = api.unique_identities(self.db, m.uuid)[0]
  
          return new_uuid
docs: Merge unique identity with uuid when a match is found