code: def unique(seq):
      
      seen = {}
      result = []
      for item in seq:
          marker = item
          if marker in seen:
              continue
          seen[marker] = 1
          result.append(item)
      return result
docs: Helper function to include only unique monomials in a basis.