class_docstr: An OrderedSet is a custom MutableSet that remembers its order, so that
  every entry has an index that can be looked up.
  
  Example:
      >>> OrderedSet([1, 1, 2, 3, 2])
      OrderedSet([1, 2, 3])
class_docstr_tok: ["An","OrderedSet","is","a","custom","MutableSet","that","remembers","its","order",",","so","that","every","entry","has","an","index","that","can","be","looked","up",".","Example",":",">",">",">","OrderedSet","(","[","1",",","1",",","2",",","3",",","2","]",")","OrderedSet","(","[","1",",","2",",","3","]",")"]
docstr: Add `key` as an item to this OrderedSet, then return its index.
  
  If `key` is already in the OrderedSet, return the index it already
  had.
  
  Example:
      >>> oset = OrderedSet()
      >>> oset.append(3)
      0
      >>> print(oset)
      OrderedSet([3])
docstr_tok: ["Add","`","key","`","as","an","item","to","this","OrderedSet",",","then","return","its","index",".","If","`","key","`","is","already","in","the","OrderedSet",",","return","the","index","it","already","had",".","Example",":",">",">",">","oset","=","OrderedSet","(",")",">",">",">","oset.append","(","3",")","0",">",">",">","print","(","oset",")","OrderedSet","(","[","3","]",")"]
code: def add(self, key):
      """
      Add `key` as an item to this OrderedSet, then return its index.
  
      If `key` is already in the OrderedSet, return the index it already
      had.
  
      Example:
          >>> oset = OrderedSet()
          >>> oset.append(3)
          0
          >>> print(oset)
          OrderedSet([3])
      """
      if key not in self.map:
          self.map[key] = len(self.items)
          self.items.append(key)
      return self.map[key]
  
imports: import itertools
  from collections import deque
label_desc: Use image node_id 8 for calling the OrderedSet obj's underlying member method code with example usage: obj.add(key) and returns: self