def METHOD_NAME(self, debates):
    """Returns a list of tuples `(debate, constraints)`, where `constraints`
    is a list of constraints. Each list of constraints is sorted by
    descending order of priority. Debates with no constraints are omitted
    from the dict, so each list of constraints is guaranteed not to be
    empty.
    The constraints for each debate are just all the venue constraints
    relating to the teams, adjudicators, and institutions of the debate."""
    all_constraints = {}
    for vc in VenueConstraint.objects.filter_for_debates(debates).prefetch_related('subject'):
        all_constraints.setdefault(vc.subject, []).append(vc)
    debate_constraints = []
    for debate in debates:
        subjects = itertools.chain(
            debate.teams,
            debate.adjudicators.all(),
            [team.institution for team in debate.teams],
        )
        constraints = [vc for subject in subjects for vc in all_constraints.get(subject, [])]
        if len(constraints) > 0:
            constraints.sort(key=lambda x: x.priority, reverse=True)
            debate_constraints.append((debate, constraints))
            logger.info("Constraints on %s: %s", debate, constraints)
    debate_constraints.sort(key=lambda x: x[1][0].priority, reverse=True)
    return debate_constraints