def invert_node_predicate(node_predicate: NodePredicate) -> NodePredicate:  # noqa: D202
    """Build a node predicate that is the inverse of the given node predicate."""

    def inverse_predicate(graph: BELGraph, node: BaseEntity) -> bool:
        """Return the inverse of the enclosed node predicate applied to the graph and node."""
        return not node_predicate(graph, node)

    return inverse_predicate
Build a node predicate that is the inverse of the given node predicate.