code: def do_unique(environment, value, case_sensitive=False, attribute=None):
      
      getter = make_attrgetter(
          environment, attribute,
          postprocess=ignore_case if not case_sensitive else None
      )
      seen = set()
  
      for item in value:
          key = getter(item)
  
          if key not in seen:
              seen.add(key)
              yield item
docs: Returns a list of unique items from the the given iterable.
  
      .. sourcecode:: jinja
  
          {{ ['foo', 'bar', 'foobar', 'FooBar']|unique }}
              -> ['foo', 'bar', 'foobar']
  
      The unique items are yielded in the same order as their first occurrence in
      the iterable passed to the filter.
  
      :param case_sensitive: Treat upper and lower case strings as distinct.
      :param attribute: Filter objects with unique values for this attribute.