def get_objects(graph, predicate, subject=None):
    """Return a set of all the objects that match a predicate (and subject).

    :graph: The policy graph.
    :predicate: The predicate of the rules to match.
    :subject: The subject of the rules to match (defaults to any).
    :return: A set of all the objects that match the parameters in the graph.
    """
    triples = graph.triples((subject, predicate, None))
    return set(obj for (subj, pred, obj) in triples)