docs: def _sorted_by_priority(self, fmtos, changed=None):
          """Sort the formatoption objects by their priority and dependency
  
          Parameters
          ----------
          fmtos: list
              list of :class:`Formatoption` instances
          changed: list
              the list of formatoption keys that have changed
  
          Yields
          ------
          Formatoption
              The next formatoption as it comes by the sorting
  
          Warnings
          --------
          The list `fmtos` is cleared by this method!"""
          def pop_fmto(key):
              idx = fmtos_keys.index(key)
              del fmtos_keys[idx]
              return fmtos.pop(idx)
  
          def get_children(fmto, parents_keys):
              all_fmtos = fmtos_keys + parents_keys
              for key in fmto.children + fmto.dependencies:
                  if key not in fmtos_keys:
                      continue
                  child_fmto = pop_fmto(key)
                  for childs_child in get_children(
                          child_fmto, parents_keys + [child_fmto.key]):
                      yield childs_child
                  # filter out if parent is in update list
                  if (any(key in all_fmtos for key in child_fmto.parents) or
                          fmto.key in child_fmto.parents):
                      continue
                  yield child_fmto
  
          fmtos.sort(key=lambda fmto: fmto.priority, reverse=True)
          fmtos_keys = [fmto.key for fmto in fmtos]
          self._last_update = changed or fmtos_keys[:]
          self.logger.debug("Update the formatoptions %s", fmtos_keys)
          while fmtos:
              del fmtos_keys[0]
              fmto = fmtos.pop(0)
              # first update children
              for child_fmto in get_children(fmto, [fmto.key]):
                  yield child_fmto
              # filter out if parent is in update list
              if any(key in fmtos_keys for key in fmto.parents):
                  continue
              yield fmto