code: def perform_vote(inputs, synclist, voters):
      num_candidates = 0
      candidates = [{"char": None, "num_votes": 0} for _ in voters]
      output = []
  
      def place_vote(c, num_candidates, num_votes=1):
          index = 0
          if c is not None:
              while index < num_candidates and (
                  candidates[index]["char"] is None
                  or candidates[index]["char"] != c
              ):
                  index += 1
          else:
              while index < num_candidates and (
                  candidates[index]["char"] is not None
              ):
                  index += 1
  
          if index < num_candidates:
              candidates[index]["num_votes"] += num_votes
              return num_candidates
          else:
              candidates[i]["char"] = c
              candidates[i]["num_votes"] = num_votes
              return num_candidates + 1
  
      def winner(num_candidates):
          if num_candidates == 0:
              return True, "", 0
  
          leader = 0
          total_votes = candidates[0]["num_votes"]
          for i in range(1, num_candidates):
              total_votes += candidates[i]["num_votes"]
              if (
                  candidates[i]["num_votes"]
                  > candidates[leader]["num_votes"]
              ):
                  leader = i
  
          if candidates[leader]["char"] is None:
              return False, "", 0
  
          return (
              True,
              candidates[leader]["char"],
              candidates[leader]["num_votes"] / total_votes,
          )
  
      for sync in synclist:
          r = True
          while r:
              for i, voter in enumerate(voters):
                  if sync.start(i) <= sync.stop(i):
                      num_candidates = place_vote(
                          inputs[i][sync.start(i)], num_candidates
                      )
                      sync.set_start(i, sync.start(i) + 1)
                  else:
                      num_candidates = place_vote(None, num_candidates)
  
              r, out, p = winner(num_candidates)
              if len(out) > 0:
                  output.append((out, p))
              num_candidates = 0
  
      return output
  
file_path: calamari/calamari_ocr/ocr/voting/sequence_voter.py
imports: import numpy
  from calamari_ocr.ocr.dataset.textprocessors import synchronize
  from calamari_ocr.ocr.voting.voter import Voter
label_desc: Use image node_id 4 for calling the SequenceVoter obj's underlying member method code with example usage: obj.perform_vote(inputs, synclist, voters) and returns: output, True,  candidates,  unknown, num_candidates, unknown, True,  str,  int, False,  str,  int