code: def pop(self, last=True):
      if not self:
          raise KeyError("set is empty")
      key = next(reversed(self)) if last else next(iter(self))
      self.discard(key)
      return key
  
file_path: nibabel/nibabel/externals/oset.py
imports: from collections.abc import MutableSet
label_desc: Use image node_id 9 for calling the OrderedSet obj's underlying member method code with example usage: obj.pop(last) and returns: key