code: def compute_score(markers, bonus, penalty):
      
      nmarkers = len(markers)
      s = [bonus] * nmarkers   # score
      f = [-1] * nmarkers  # from
      for i in xrange(1, nmarkers):
          for j in xrange(i):
              mi, mj = markers[i], markers[j]
              t = bonus if mi.mlg == mj.mlg else penalty + bonus
              if s[i] < s[j] + t:
                  s[i] = s[j] + t
                  f[i] = j
      # Recover the highest scoring chain
      highest_score = max(s)
      si = s.index(highest_score)
      onchain = set()
      while True:
          if si < 0:
              break
          si = f[si]
          onchain.add(si)
      return [x for i, x in enumerate(markers) if i in onchain]
docs: Compute chain score using dynamic programming. If a marker is the same
      linkage group as a previous one, we add bonus; otherwise, we penalize the
      chain switching.