def invert_edge_predicate(edge_predicate):
    """Build an edge predicate that is the inverse of the given edge predicate.

    :param edge_predicate: An edge predicate
    :type edge_predicate: (pybel.BELGraph, BaseEntity, BaseEntity, str) -> bool
    :rtype: (pybel.BELGraph, BaseEntity, BaseEntity, str) -> bool
    """

    def _inverse_filter(graph, u, v, k):
        return not edge_predicate(graph, u, v, k)

    return _inverse_filter