docs: def mostCommon(L):
      """
          #   http://stackoverflow.com/questions/1518522/python-most-common-element-in-a-list
          
          >>> mostCommon([1, 2, 2, 3])
          2
          >>> mostCommon([1, 2, 3])
          1
          >>> mostCommon([-1, 2, 3])
          -1
          >>> mostCommon([-1, -2, -3])
          -1
          >>> mostCommon([-1, -2, -3, -1])
          -1
          >>> mostCommon([-1, -1, -2, -2])
          -1
          >>> mostCommon([0, 0.125, 0.275, 1])
          0
          >>> mostCommon([0, 0.1, 0.4, 0.4])
          0.4
      """
      # get an iterable of (item, iterable) pairs
      SL = sorted((x, i) for i, x in enumerate(L))
      # print 'SL:', SL
      groups = itertools.groupby(SL, key=operator.itemgetter(0))
      # auxiliary function to get "quality" for an item
      def _auxfun(g):
          item, iterable = g
          count = 0
          min_index = len(L)
          for _, where in iterable:
              count += 1
              min_index = min(min_index, where)
          # print 'item %r, count %r, minind %r' % (item, count, min_index)
          return count, -min_index
      # pick the highest-count/earliest item
      return max(groups, key=_auxfun)[0]