code: def _finish_filter(self, lst, key, include_self, exclusive, biggest_first):
          
          key = self._actual_key(key)
          locations = [x[0] for x in lst]
  
          if not include_self and key in locations:
              lst.pop(locations.index(key))
  
          lst.sort(key=lambda x: x[1], reverse=biggest_first)
          lst = [x for x, y in lst]
  
          # RoW in both key and lst, but not defined; only RoW remains if exclusive
          if key == 'RoW' and 'RoW' not in self and exclusive:
              return ['RoW'] if 'RoW' in lst else []
          elif exclusive:
              removed, remaining = set(), []
              while lst:
                  current = lst.pop(0)
                  faces = self[current]
                  if not faces.intersection(removed):
                      removed.update(faces)
                      remaining.append(current)
              lst = remaining
  
          # If RoW not resolved, make it the smallest
          if 'RoW' not in self and 'RoW' in lst:
              lst[-1 if biggest_first else 0] = lst.pop(lst.index('RoW'))
  
          return lst
docs: Finish filtering a GIS operation. Can optionally exclude the input key, sort results, and exclude overlapping results. Internal function, not normally called directly.