code: def find_subgraphs_by_preds(xmrs, preds, connected=None):
      
      preds = list(preds)
      count = len(preds)
      # find all lists of nodeids such that the lists have no repeated nids;
      # keep them as a list (fixme: why not just get sets?)
      nidsets = set(
          tuple(sorted(ns))
          for ns in filter(
              lambda ns: len(set(ns)) == count,
              product(*[select_nodeids(xmrs, pred=p) for p in preds])
          )
      )
      for nidset in nidsets:
          sg = xmrs.subgraph(nidset)
          if connected is None or sg.is_connected() == connected:
              yield sg
docs: Yield subgraphs matching a list of predicates.
  
      Predicates may match multiple EPs/nodes in the *xmrs*, meaning that
      more than one subgraph is possible. Also, predicates in *preds*
      match in number, so if a predicate appears twice in *preds*, there
      will be two matching EPs/nodes in each subgraph.
  
      Args:
          xmrs (:class:`~delphin.mrs.xmrs.Xmrs`): semantic structure to
              use
          preds: iterable of predicates to include in subgraphs
          connected (bool, optional): if `True`, all yielded subgraphs
              must be connected, as determined by
              :meth:`Xmrs.is_connected() <delphin.mrs.xmrs.Xmrs.is_connected>`.
      Yields:
          A :class:`~delphin.mrs.xmrs.Xmrs` object for each subgraphs found.