code: def gen_parents(parents):
      
      for idx, parent in enumerate(parents):
          if isinstance(parent, Interface):
              parent = parent.id
          elif isinstance(parent, int):
              pass
          else:
              raise TypeError(
                  'parent[%d] must be an Interface or int, not %s' % (
                      idx, type(parent).__name__))
          yield parent
docs: Generate the parents to send to the handler.