code: def _chooseBestSegmentPerColumn(cls, connections, matchingCells,
                                    allMatchingSegments, potentialOverlaps,
                                    cellsPerColumn):
      
  
      candidateSegments = connections.filterSegmentsByCell(allMatchingSegments,
                                                           matchingCells)
  
      # Narrow it down to one segment per column.
      cellScores = potentialOverlaps[candidateSegments]
      columnsForCandidates = (connections.mapSegmentsToCells(candidateSegments) /
                              cellsPerColumn)
      onePerColumnFilter = np2.argmaxMulti(cellScores, columnsForCandidates)
  
      learningSegments = candidateSegments[onePerColumnFilter]
  
      return learningSegments
docs: For all the columns covered by 'matchingCells', choose the column's matching
      segment with largest number of active potential synapses. When there's a
      tie, the first segment wins.
  
      @param connections (SparseMatrixConnections)
      @param matchingCells (numpy array)
      @param allMatchingSegments (numpy array)
      @param potentialOverlaps (numpy array)