def select_links(xmrs, start=None, end=None, rargname=None, post=None):
    """
    Return the list of matching links for *xmrs*.

    :class:`~delphin.mrs.components.Link` objects for *xmrs* match if
    their `start` matches *start*, `end` matches *end*, `rargname`
    matches *rargname*, and `post` matches *post*. The *start*, *end*,
    *rargname*, and *post* filters are ignored if they are `None`.

    Args:
        xmrs (:class:`~delphin.mrs.xmrs.Xmrs`): semantic structure to
            query
        start (optional): link start nodeid to match
        end (optional): link end nodeid to match
        rargname (str, optional): role name to match
        post (str, optional): Link post-slash label to match
    Returns:
        list: matching links
    """
    linkmatch = lambda l: (
        (start is None or l.start == start) and
        (end is None or l.end == end) and
        (rargname is None or l.rargname == rargname) and
        (post is None or l.post == post))
    return list(filter(linkmatch, links(xmrs)))