Media playback is unsupported on your device Media caption The Institute for Government says time is running short to implement a successful Brexit

With just over six months to go until Britain is due to leave the European Union, a report from the London-based think tank, the Institute for Government (IFG), has warned that - deal or no deal - the government is running short of time to implement a successful Brexit.

The IFG says Theresa May's government has left its "no-deal" preparations too late to help many businesses, and in most policy areas it would not be able to avoid damage to the economy next year.

Even if a deal is reached, the IFG says, the proposed 21-month transition period after Brexit - which would expire at the end of December 2020 - does not give enough time to agree and ratify a future trade deal.

BBC News asked the IFG to assess the readiness of preparations for leaving the EU, which the report describes as an "unprecedented task for modern government".

The report divides the challenges into negotiation, legislation and implementation and identifies serious obstacles in all three areas, concluding that implementation is the biggest concern of all.

Progress has certainly been made on negotiations on a Withdrawal Agreement, and there is "potential for a deal" in the coming weeks. But talks on the outline of a future trade relationship have barely begun.

And if the Withdrawal Agreement is not finalised soon, time to pass the necessary legislation to ratify and implement it will be in short supply.

Implementation

When it comes to "no-deal" plans, ministers insist they are "far advanced" and the IFG agrees that progress has been made. But businesses also need to be ready for dramatic change and the IFG says government guidance to business and consumers on how to prepare has come too late. The report says other European governments, such as the Irish and Dutch, published their "no-deal" guidance "much earlier".

The report uses a traffic light system to assess overall progress.

If the UK leaves the EU without a deal in March 2019, only one policy area - EU programmes and funds - is coloured green, suggesting that the government will be ready.

Nine other broad policy areas - including borders, citizens and migration, agriculture, fisheries and food, health, transport, tax and data and services - are given a red light, suggesting the government won't be able to avoid "major negative impacts" of no deal next year.

Even if a deal is reached, which is what the government wants, implementing Brexit in the 21-month transition period - which would, among other things, mean agreeing and ratifying a future trade deal - looks "completely unfeasible", according to the report.

For example, the IFG says that more than 140,000 businesses would need to be ready for changes at UK borders, and new customs systems would not be ready in time.

It notes that the government is hiring 9,000 extra staff and spending £2bn on Brexit preparations by March 2019, with more money allocated for 2019-20; but it warns that "Brexit is the biggest implementation challenge government has faced in generations".

To give a sense of scale, it has compared the Brexit transition with other major UK government projects over the last few years.

The automatic pension enrolment programme, and preparations for the London Olympics, both took more than a decade to prepare and implement; digitising tax took five years.

Implementing Brexit in 21 months will, by comparison, be extremely tight.

The IFG report also compares the length of the transition period (21 months) with the time taken to negotiate and fully implement recent free trade agreements. The EU-Canada free trade deal that we hear so much about has taken more than seven years so far. The EU-South Korea deal took nine years.

In other words, even if "no deal" on a withdrawal agreement is avoided in March 2019, the government will still be facing the prospect of "no deal" on a comprehensive trade agreement in December 2020, at the end of the transition period.

Legislation

The clock is ticking in Parliament too.

If a deal on a Withdrawal Agreement is reached this autumn, possibly in mid-November, there would only be about 70 sitting days in Parliament before Brexit is due to happen.

In the past, says the IFG, significant treaty change has taken about 40 days to get through Parliament.

Part of a potential 70-day period would have to be devoted to other issues such as debating the Budget and passing a finance bill.

The government will also need to win a "meaningful vote" on its deal with the EU in the House of Commons, before trying to pass legislation giving the Withdrawal Agreement effect in UK law.

And while a number of votes may be tight, so too will be the number of days. The House of Commons could choose to sit more often on a Friday to add extra days, but there will not be much room for manoeuvre.

Image copyright PA

In the past 18 months, the IFG says there have been some big achievements and the government has passed six of the 13 Brexit bills currently announced. But there are now only six months to go.

The government also needs to pass about 800 pieces of secondary legislation (known as statutory instruments) to ensure that UK law actually works properly on the day the UK leaves the EU.

The Department for Exiting the European Union says its planning demonstrates that it can be done, but "there is a lot of work to do in order to manage it".

Please upgrade your browser Your guide to Brexit jargon Enter the word or phrase you are looking for Search

An additional challenge, the IFG points out, is that "until a full Withdrawal Agreement is locked down in legal text", government preparations for no deal have to continue.

In the event of no deal, of course, Parliament will have to scramble to pass all sorts of legislation for sudden change in a whole host of policy areas.

"There is a real risk," the IFG argues, "that this will not be in place, and the UK will face a legal hiatus."

Image copyright Getty Images

The risks are reflected in the traffic lights: if there is a deal they are green for most legislation, except for the Withdrawal Agreement Bill, which would still need to be passed and is flashing amber.

With no deal, again there is some green, indicating that plans are already in place. But there are plenty of pieces of legislation coloured amber, suggesting uncertainty, and on the future rights of citizens in the event of no deal, the lights remain red.

Negotiation

An awful lot depends on the next few weeks - as negotiations with the EU on a Withdrawal Agreement, the terms on which the UK will leave, reach their final phase.

The two sides also need to agree a political declaration on the future relationship - and persuade the UK and European parliaments to accept it all.

The IFG's negotiation traffic lights have a lot in green, including a financial settlement, citizens, and agreement in principle on the transition period. Officials say the deal is at least 80% done.

"We make progress every week and a deal is within our sights," Brexit Secretary Dominic Raab told the House of Commons this month.

But the IFG also designates some amber issues - including governance (the role of the European Court of Justice), and the status of Gibraltar; while the toughest part of all - avoiding a hard border in Ireland - is still flashing red.

The other red light in this section refers to the fraught process of ratification in the UK Parliament, while the government also needs to renegotiate hundreds of agreements with other countries - on trade and other issues - to replace those it has been part of as an EU member.

Brexit, the IFG concludes, is likely to lead to "unprecedented levels of change across huge swathes of policy simultaneously".

That is one of the reasons why many people are campaigning for a People's Vote or second referendum, once the details of any deal to leave are revealed.

That, of course, is not government policy.

But with six months to go, the whole process remains highly uncertain.

What do you want BBC Reality Check to investigate? Get in touch

Read more from Reality Check

Follow us on Twitter