def select_nodes(xmrs, nodeid=None, pred=None):
    """
    Return the list of matching nodes in *xmrs*.

    DMRS :class:`nodes <delphin.mrs.components.node>` for *xmrs* match
    if their `nodeid` matches *nodeid* and `pred` matches *pred*. The
    *nodeid* and *pred* filters are ignored if they are `None`.

    Args:
        xmrs (:class:`~delphin.mrs.xmrs.Xmrs`): semantic structure to
            query
        nodeid (optional): DMRS nodeid to match
        pred (str, :class:`~delphin.mrs.components.Pred`, optional):
            predicate to match
    Returns:
        list: matching nodes
    """
    nodematch = lambda n: ((nodeid is None or n.nodeid == nodeid) and
                           (pred is None or n.pred == pred))
    return list(filter(nodematch, nodes(xmrs)))