Democrats have reason to be frustrated these days. They won the presidential popular vote and the Senate popular vote, and they were just shy of winning the House popular vote. And yet they are entirely shut out of power in Washington. The Electoral College and Senate are here to stay, needless to say, but Democrats do have an unexpected chance to make substantial gains in the House and in state legislatures post-2020 if they can convince the Supreme Court to go along. It’s a long shot, to be sure, but it’s got a better chance of succeeding than some of their other options: Jill Stein’s recount efforts or a time machine.

The unexpected ray of hope comes from a partisan gerrymandering case in Wisconsin. An eclectic group of academics and lawyers managed to pull off the all but impossible when they convinced a court to strike down Wisconsin’s state districting on constitutional grounds. The case is guaranteed a hearing by the Supreme Court, and it provides Democrats some hope of tamping down on the partisan gerrymanders that have handicapped their candidates since 2011, the last time districts were drawn.

That straight line to the Supreme Court is one reason the Wisconsin win matters so much. Most of the Court’s docket is discretionary, and the Court is not above ducking controversial questions it’s not ready to decide. But due to special procedural rules for certain voting rights cases, the Supreme Court must hear this case. Rather than “deny cert” and say nothing, as the Court does with almost all the cases it is asked to review, it must either affirm or reverse the lower court decision. (The Court can “summarily” affirm or reverse, but that’s also why the district court win matters here. The Court is highly likely to give the case a full-blown review given that plaintiffs won below.) The decision is likely to come down in the spring and, absent another miraculous win for plaintiffs in some other case, will likely be the Court’s last word on the subject before 2020.

This is also probably Justice Kennedy’s last chance to serve as the crucial fifth vote in holding partisan gerrymanders unconstitutional. By the time another case reaches the Court, the odds are that President-Elect Donald Trump will have replaced at least one justice on the left, depriving Kennedy of his swing vote and probably foreclosing any chance of policing partisan gerrymandering during the next redistricting cycle. Today’s Court will be as friendly as any reformers will see for a good long while.

Districting happens every 10 years, as soon as the decennial census data is released. While a few states rely on nonpartisan or bipartisan commissions to draw districts, most districts are drawn by state legislators. That means that most districts are drawn by the people who directly benefit from gerrymandering: self-interested partisan officials. That’s precisely why redistricting is referred to as a “blood sport”; it’s a chance to help your party and hurt the other side.

The GOP controlled much of redistricting during the 2010 cycle. It drew itself a set of plans that ensured, as the Princeton neuroscientist and political blogger Sam Wang points out, that Democrats would have had to win the popular vote by at least 9 percentage points to take control of the House this year. If the GOP retains this advantage as we move into the 2020 redistricting cycle, the Democrats will be at a severe disadvantage. A partisan gerrymandering rule could make all the difference.

Why has it taken the Supreme Court so long to get involved in this issue?

Almost no one thinks it’s a good idea to have partisan legislators drawing their own districts. So you may be surprised that the Supreme Court has done nothing to halt this pernicious practice. But there isn’t just disagreement about what courts should do about the problem — justices aren’t even sure that judges should entertain partisan gerrymandering claims in the first place.

In general the Court is deeply reluctant to move deep into what Justice Felix Frankfurter famously called “the political thicket.” Haunted by what lawyers call the “countermajoritarian difficulty,” the justices are highly sensitive about giving the impression that nine unelected people are overriding the decisions of a democratically elected legislature.

For judges worried about invading democracy’s turf, elections are where they most fear to tread. Taking a position in almost any case means picking a political winner. Just think about the fallout from Bush v. Gore and you’ll understand why judges are reluctant to intervene. Regardless of whether you think the Court was right to step in, many people have accused the Republican-dominated Court of picking our president.

In addition, the Constitution is almost silent about how our democracy is supposed to work. Modern constitutions in other countries typically have a lot to say about how elections should be run. But America’s framers didn’t even anticipate that there would be political parties in the first place. As a result, they didn’t think hard about which institutions would referee political battles, let alone how to protect those institutions from partisan taint. That’s a real problem for judges looking for principles to guide them. Judges can’t decide elections cases without deciding how power should be divided, which necessarily means choosing one theory of democracy over another.

The challenge involves finding a clear standard that can be enforced

For example, a judge can’t decide whether a districting scheme is “fair” to a political party without having an idea of what “fair” is. Should every party get a proportional share of seats? Or does democracy only require that a majority of voters can control a majority of seats? How should judges think about what constitutes political power — is it better to exercise influence in many districts or control outcomes in a few?

Given that districting always ends up disadvantaging some and advantaging others, judges also have to decide which groups deserve protection. Finally, as judges well understand, predictability is crucial for election law. It’s essential that the rules of the game be stable and fixed in advance. Deciding an election law case is thus the judicial equivalent of a high-difficulty dive, which helps to explain why the Court hasn’t intervened in a partisan gerrymandering case in three decades.

All the worries judges have about intervening in elections cases get expressed through highly technical debates over “manageable standards” and “justiciability.” Basically, the justices worry they will embarrass themselves if they try to decide partisan gerrymandering claims without an easily applied, easily defended standard. (If there’s no way for different judges to apply a rule consistently and predictably to resolve an agreed-upon problem, those disputes are not “justiciable.”)

The touchstone for manageable standards in election law is the one person, one vote test, which mandates near-perfect mathematical equality for congressional districts in a given state. The test is so simple and rigid that one justice condemned it as “sixth-grade arithmetic.” But simplicity and rigidity are features, not bugs, when it comes to manageable standards. The one person, one vote test is deeply intuitive, it’s easily applied, and it generates predictable results. Moreover, because it requires so little discretion on judges’ part, they feel comfortable applying it even in hotly contested political cases.

You might think that the one person, one vote principle might offer a solution to partisan gerrymandering. It doesn’t. In most places, you can draw districts with equal populations and still decimate a given party simply by spreading its voters out across many districts, or concentrating them in such a way that the other party will lose most races.

The most recent debate over the justiciability of partisan gerrymandering claims took place in 2004 in a Supreme Court case called Vieth v. Jubelirer, which challenged a gerrymander in Pennsylvania. The four conservatives insisted that the case was not justiciable for want of manageable standards. Any “solution,” they said, would just amount to substituting one politically debatable decision on how to draw lines for another. The four liberals insisted that a manageable standard existed but couldn’t agree as to what it was. And while Justice Kennedy couldn’t find a standard to his liking, he suggested he wasn’t ready to give up on the enterprise entirely.

When another partisan gerrymander claim in Texas also went by the wayside in 2006 because the Court decided the case on other grounds, lawyers decided that Justice Kennedy didn’t really mean what he said about being interested in finding a manageable standard for such cases, and they focused their energies elsewhere.

A political scientist invented a new tool to measure unfairness

Now, more than a decade after Justice Kennedy insisted that he would entertain a partisan gerrymandering claim if a manageable standard could be found, several academics and lawyers have decided to take him at his word. Eric McGhee, a political scientist who works for the Public Policy Institute of California, invented a new standard for measuring partisan gerrymanders: the efficiency gap. It tests whether a districting plan treats Republicans and Democrats similarly by assessing what share of their votes are “wasted” under a given plan.

The concept of “wasted votes” is crucial to understanding and challenging gerrymandering. If your party is in power, you want its votes deployed efficiently, with sensible but not overwhelming majorities in as many districts as possible. You also want the other party to waste as many votes as possible — either by voting for lost-cause candidates or by widening the margins for candidates who were going to win in any case. You can spread the opposing party’s voters across many districts so they can’t garner a majority anywhere (this is called “cracking”), or you can shove lots of your opponents into a single district so they cast many more votes than necessary to win the seat (“packing”). If your side has wasted a substantially larger share of votes than the other side, the odds are that you’ve been the victim of a partisan gerrymander.

McGhee paired up with Nick Stephanopoulos, an up-and-coming law professor at the University of Chicago, to frame and situate the standard in the case law. Through a series of fortuitous connection, their paper made its way to a group interested in challenging the GOP’s partisan gerrymander in Wisconsin, which allowed the GOP to win 60 of 99 seats in 2012 even though it won less than half of the statewide vote. The trial was run by the stalwarts at the Campaign Legal Center, including the much-revered Gerry Hebert.

In the Wisconsin case, the district court found that an efficiency gap of 7 percent meant that a party would have almost no chance of taking control of the legislature during the 10-year districting cycle. (The actual gap in Wisconsin was 13 percent in favor of the Republicans in 2012, and 10 percent in 2014.) The redistricting, it concluded, was therefore an unconstitutionally partisan gerrymander.

Unlike other notorious gerrymanders, the Wisconsin case doesn’t involved absurdly shaped districts

The case isn’t an ideal test case, by any means. Usually gerrymanders involve “flights of cartographic fancy” — outlandishly shaped districts, like the one that gave gerrymandering its name — but Wisconsin’s districts were relatively compact. Moreover, Republicans are now in the majority in Wisconsin, so this is no longer a case where the minority is gerrymandering itself into majority control. But a better case isn’t coming along anytime soon. It may be now or never.

No one knows whether Kennedy will find the efficiency gap standard to be “manageable.” That why reformers would be wise to give him choices other than the efficiency gap standard while still taking a cue from the Wisconsin decision.

The efficiency gap test is what political scientists call a “partisan symmetry” test because it evaluates whether the parties have been treated equally. Partisan symmetry tests are deeply intuitive. They don’t require judges to decide how many seats a party should hold, an inquiry that can make judges uncomfortable because they worry about deciding how power should be distributed. Instead, judges need only evaluate whether the parties were treated symmetrically. That is the kind of decision that judges make routinely in other areas of the law.

But the efficiency gap isn’t the only partisan symmetry standard out there, and it would make sense to put similar standards in front of the Court. Indeed, one could imagine the Court holding that “partisan symmetry” is the right baseline for assessing gerrymanders but leaving it to the lower courts to decide which ones to use. For this reason, academics and lawyers should coordinate an effort to get the best social science in front of the Court. It’s a long shot. But, again, it may be the best shot that reformers — and Democrats — have these days.

If the Court were to find partisan gerrymanders justiciable, the immediate effects would only be felt in Wisconsin, which would have to redraw its districts. But the decision would hang like the sword of Damocles over every single districting effort that takes place after the 2020 census. The mere threat of future lawsuits would do a great deal to tamp down on partisan gerrymandering.

Politicians are delighted to gerrymander when it costs them nothing, but they aren’t willing to put their own fortunes at risk. Lawsuits are dangerous. A lawsuit not only threatens to upend existing plans but often creates the risk that courts rather than legislatures will draw the districts at the end of the day. Politicians are likely to be careful and protect their own seats rather than gerrymander aggressively to help their parties. And the aggressive gerrymanders, of course, would inevitably land in courts, which is the last place most politicians want to be.

But right now, Wisconsin Democrats are justifiably ecstatic to be headed to the Supreme Court. Everyone who cares about reform should be ecstatic, too.

Heather K. Gerken is the J. Skelly Wright professor of Law at Yale Law School.