code: def unique(s):
      n = len(s)
      if n == 0:
          return []
      u = {}
      try:
          for x in s:
              u[x] = 1
      except TypeError:
          pass
      else:
          return list(u.keys())
      del u
      try:
          t = sorted(s)
      except TypeError:
          pass
      else:
          assert n > 0
          last = t[0]
          lasti = i = 1
          while i < n:
              if t[i] != last:
                  t[lasti] = last = t[i]
                  lasti = lasti + 1
              i = i + 1
          return t[:lasti]
      del t
      u = []
      for x in s:
          if x not in u:
              u.append(x)
      return u