President Obama may have nearly another 11 months in office, but under a new bill that passed Congress on Monday, his administration will have to begin preparing to turn over the keys as early as May.

The legislation, which the House approved by voice vote on Monday evening following passage by the Senate last year, requires the president to establish a pair of transition councils six months before the election. The goal is both to help the government withstand the departure of hundreds of political appointees before Obama’s term ends and to assist the major candidates with the Herculean task of staffing the government upon taking office. What it also means in practice is that the Obama administration could be meeting with advisers to both Hillary Clinton and Donald Trump—or Marco Rubio or Bernie Sanders—long before they formally accept their party’s nominations in July.

The bill is the outgrowth of a 15-year effort to improve the presidential transition process, and it builds upon a law enacted in 2010 that required the government, through the General Services Administration, to offer transition services to the major-party nominees before the election. “An outgoing administration, even under current law, is in essence required to do nothing to hand off in an effective way. This legislation changes that,” said Max Stier, founding president and CEO of the Partnership for Public Service, which last month established a Center for Presidential Transition to help candidates navigate the process.

Beyond the high-profile Cabinet selections that generate the most attention during the months between November and January, incoming administrations must hire some 4,000 political appointees—a process that takes months because so many of them either need security clearances or require Senate confirmation. Many political appointees leave weeks or months before the end of a president’s term, and the legislation requires agencies to designate career civil servants who can fill these positions temporarily beginning as early as September, to keep the government operating smoothly.

Historically, presidential candidates have been reluctant to prepare too overtly in advance of the election out of a fear that voters would punish them for “measuring the drapes.” The push to formalize the transition process is in part an effort to have Congress grant political cover for candidates to begin planning earlier. Four years ago, Mitt Romney designated former Utah Governor Mike Leavitt, who had served in President George W. Bush’s Cabinet, to build what became almost a shadow government in advance of the election, and despite the hard-fought race to unseat Obama, Leavitt was assisted by administration officials before the election.

The 2016 race has become an even messier affair, and while Clinton appears poised to effectively lock up the Democratic nomination in the next several weeks, the Republican primary could drag on far longer. Even so, Stier said his organization is urging the remaining serious candidates to designate a transition leader by the beginning of April. Presidential candidates have already been able to get national security briefings once they become their party’s nominee, and this legislation doesn’t change that. It does, however, require the administration to submit an additional threat assessment to Congress.

An added wrinkle is that although the new bill requires the Obama administration to offer services and assistance to the campaigns, it doesn’t force the candidates to accept them. Would Donald Trump take help from a government whose officials he has routinely denounced as “stupid” and “incompetent”? “They can walk in and be unprepared and be ill-prepared if they so choose, but there’s no reason for them to do it because we’re making it real easy for them,” Stier said. “It doesn’t matter whether you’re an establishment or an anti-establishment candidate, you still need to be ready on Day 1 to run our country, and that’s what this is about.”

The Republican Party is now having fits as it confronts the surprising likelihood that Trump could be its nominee and, potentially, the next president. With this new law, the Obama administration must prepare for the same possibility much sooner than you’d think.