Deep in Liam Fox's new Department for International Trade, civil servants are hopefully hard at work on our tariff rate quotas. If they're not, we're in serious trouble. If they are not extremely talented and diligent, we're in serious trouble. If they do not exercise good judgement and deploy sophisticated negotiating tactics, we're in serious trouble. If their boss has misunderstood the task before him, or allowed ideological concerns to override hs attention to detail, we're in serious trouble. So let's hope none of those things are true.

Tariff rate quotas are a nightmare. They are the one part of the WTO arrangement that Britain can't replicate, or seek to join, or copy and paste into existence. They require very careful calculations. These calculations are so careful, and so complex, that the EU hasn't established new legally certified schedules since the period in which it only had 15 members. The updated quotas are kept under wraps because they haven't been able to agree them properly.

But Britain has to produce tariff rate quotas by the time it leaves the EU. If it leaves the single market and the customs unions without a proposed trade deal (hard Brexit) the problem becomes even more complex, because you have to factor in UK-EU trade. But even if it doesn't, the tariffs for the rest of the world need sorting. This has to happen now.

The reason the tariffs are so complex is because they are a slice of the continental trade pie. Quotas are applied to imports to Europe, giving them a certain tariff level up to a certain amount and another tariff level at a further amount. So for lamb, say, 283,825 tonnes are duty free, while anything above that comes in for a standard tariff.

Now the UK needs to work out its share of that continental quota. How much of the lamb sent to Europe goes to the UK? This sounds a relatively simple question. Some have suggested you just take the last three years trade flow and use the average. Then we can just go to the WTO, put down that number and if people want to complain they can complain, but we'll trade in the meantime.

This is a gross simplification, as the careful, detailed work of Peter Ungphakorn, who spent two decades at the WTO secretariat, demonstrates. If you're into this sort of thing – and unfortunately we all now have to be – he's worth a follow on Twitter.

For a start, the trade flows are uneven, so taking the average of the last three years is a dodgy way of working it out. In 2013, Britain imported 13,422 tonnes of mutton and lamb from the EU. In 2014 it was 11,719. In 2015, it was 7,611. So sure, take the average, but that does not give a good assessment of what your trade flows are likely to be in future. And if you get those wrong you can open up your market to lots of cheap imports, hurting domestic industries – or block sufficient imports from coming in and deprive British consumers of the things they want to buy. You can be liberal or protectionist – it doesn't matter. If your official trade flows are out of kilter with your real trade flows, your policy is just a bunch of wobbly meaningless nonsense. 

But even if those trade flows averages were perfectly accurate, this is a dauntingly complicated task. You don't just need to work out the share of EU imports that go to the UK. You have to work it out for every exporting country. So for lamb the original WTO agreement – later updated by regulation – has 15 exporting countries, from Argentina to Slovenia, who have the quota allocated between them. Of them, New Zealand has the lion's share (this is lamb we're talking about, after all). It has 226,700 tonnes of a 283,825 overall quota.

The WTO is member led. The expectation is that individual countries sort things out between themselves if possible. This offers Britain a crucial opportunity. It means we can get to work on this now by having informal chats with the Kiwis and trying to smooth things out in advance of Brexit Day. Get a deal signed in pencil now and it'll be ready for rubber stamping by March 2019.

Except that arrangement with the Kiwis might irritate the other countries in that quota system. After all, there's a lot to play for. Britain is not some tiny country establishing itself on the world stage. It is, as the Brexiters keep telling us, a major consumer market and a primary cog in the international financial system. Lots of money is at stake here. Many domestic industries from pretty much every country on earth will be affected in some way. And while the media aren't too interested in this type of stuff, these industries will be watching very closely and lobbying their government heavily to get a good deal.

The Kiwis will suggest that the average of the last three year's trade flow doesn't fairly represent their exports to the UK and lobby for a better deal. We will presumably try to comply and keep them happy. After all, we are at a disadvantage. We want to be collegiate and useful. But then we have to play nice and accommodating with all the other countries in that list.

Argentina only exports 23,000 tonnes of lamb to the EU. But perhaps its domestic industry is growing and lobbying government hard. Or perhaps it enjoys disproportionate political influence at home. The fact a country has a modest export flow for a certain product does not mean it is politically unconcerned by changes to it.

And here's the rub: every country in the export quota list, regardless of its level of exports, can launch litigation against the UK if it does not approve of the quota we put down. It can send us one tonne or a million – its legal strength is the same. The potential for multiple trade disputes is vast. After all, this is not just about lamb. There are countless quotas, from meat of bovine animals, to citrus hybrids, to mushrooms, to countless varieties of cheese.

And these are complex. You've got quota rates for whole Cheddar cheeses "of the conventional flat cylindrical shape of a net weight of not less than 33kg but not more than 44kg and cheeses of the conventional flat cylindrical shape or cheeses in parallelepiped shape, of a net weight of 10 kg or more", which must have "a minimum fat content of 50% by weight in the dry matter, matured for at least three months". You've got 'edible offal of bovine animals' rates for "pasture-grazed animals, aged between 22 and 24 months, having two permanent incisors and presenting a slaughter liveweight not exceeding 460 kg". This is not a simple business.

And then there is the small matter of the EU. It has to agree to all these details itself, because its quota will obviously be that much smaller once Britain extracts its share. That is only possible if Britain and Europe are working closely and amiably together through the Article 50 process. If, as hard Brexiters frequently suggest, Britain simply storms off in a huff and goes to the WTO, the first thing it will find is a trade dispute waiting for it there from the EU because there is no agreement on quotas. And that trade dispute is likely to be one of many, with all the other countries affected queuing up behind it.

We don't quite know what happens if those disputes go against us. No-one has ever been brave or stupid enough to do this before. If past experience is anything to go by (for instance the EU-US battle over beef hormones) tariffs will go up by anything up to 100% on other industries, crippling our exports in some unrelated sector. Or if things really get bad it could lead to a trade war.

All of this is the best case scenario. If Britain pursues hard Brexit, which seems increasingly likely, and leaves the single market and customs union with no trade deal on the horizon, it needs to work out what to do about its own imports and exports from the EU, which is a whole other nightmare. That would be in addition to the quota problem for the rest of world. That takes the task from something which is possible but very difficult to something which probably isn't possible at all in this time scale.

So given the complexity of this problem, you have to really hope that Liam Fox's department has recruited the best people, who are aware of the challenges and the timeframe, and getting to work on this now. You have to hope they're being sensible and pragmatically managed to ensure that ideology does not cloud what is a very technical and difficult task. You have to hope that subtle and politically intelligent negotiating techniques are being brought to bear at the WTO to smooth the way for what is about to happen.

Because if not, we're in a lot of trouble.

Ian Dunt is the editor of His book – Brexit: What The Hell Happens Now? – is available now from Canbury Press. A Just Giving campaign has been set up to send his book to every MP. 

The opinions in's Comment and Analysis section are those of the author and are no reflection of the views of the website or its owners.