Who gets first dibs at forming a new government?

So there's going to be another hung parliament after the election?

It looks that way, yes.

Oh dear. That means more coalition mayhem after polling day? More hordes of journalists with nothing better to do than camp outside the Cabinet Office?

Very probably. Although there's half a chance the parties might decide to avoid running the gauntlet of the press by holding their talks in parliament.

And how do those talks work? Will it be David Cameron or Ed Miliband who get first go at forming a government?

That might depend on who the Liberal Democrats talk to. They declared in 2010 that they would talk first of all to whichever party gets the most seats.

That looks like it might be David Cameron just now, right?

It could be either the Conservative leader or the Labour leader – although yes, the polls in recent days are suggesting Cameron has got his nose in front.

And so he will talk to the DUP or the Lib Dems or whoever and that will be that? What about those who want to see Miliband in No 10. What if he wants to do a deal with the SNP?

There is a bit of debate about this, actually.

Surely it's all been decided by now.

Well, it should have been. The civil service were supposed to clarify matters by producing a rulebook, the Cabinet Manual, which includes a whole chapter on government formation in the event of a hung parliament.

So what does it say?

Um… it's a bit vague, to be honest.

Give me the quote then.

OK. You asked for it. "Where a range of different administrations could potentially be formed, political parties may wish to hold discussions to establish who is best able to command the confidence of the House of Commons and should form the next government."

That's not very helpful.

Not really. I did warn you. There was a row over whether the Lib Dems' behaviour in 2010 should become official, too.

Surely Nick Clegg hasn't actually managed to influence the constitution.

His quote that "whichever party has won the most votes and the most seats, if not an absolute majority, has the first right to seek to govern" was originally included as a footnote to the draft Cabinet manual.

A footnote to history? Very appropriate.

Actually it ended up being deleted after academics kicked up a stink. He was being political, they claimed, so that was discounted.

Would it make a difference who is actually the prime minister at the time?

That is a more interesting question. Because yes, it looks like it might. The old government keeps going, in a restricted form, while the coalition talks take place. That means the PM has until parliament returns to muster up a majority that will support him.

It sounds a lot like he has first dibs, then. Does this not mean he could decide to govern as a minority if he wanted to, denying a Miliband-SNP majority?

The whole system rests on the absolutely decisive nature of the confidence vote. If the Tories tried to hold on and just about managed to scrape together enough Lib Dem support to see them over the line – either via another coalition, or a formal pact, or simply by a confidence-and-supply arrangement – then they would succeed.

I don't think Ed Miliband or Alex Salmond would be very happy about that.

Of course they wouldn't. But if it was really close – and it would have to be really, really close – they'd just have to resolve between them to defeat the confidence vote.

What would happen then?

Cameron would quit. The Queen would then, according to the Cabinet manual, "invite the person who appears most likely to be able to command the confidence of the House as prime minister and to form a government".

Obviously that would be Miliband.

Yes – and there would then be another confidence vote which, presumably, he would win. If he lost we'd be in rather a lot of trouble. Please don't ask me what happens then.

But it won't, will it? The process of the coalition talks should make perfectly clear whether a Tory minority is workable.

Exactly. And, talking about it realistically, both sides will know the theatre of a confidence vote would be terrible for the markets and for the country. They'll try and avoid it by working out who governs next long before the matter actually comes to a head in the new parliament.

So the idea of first dibs is meaningless.

In all probability, yes. Even if the result is so close that both sides think they can win in the Commons, the acid test of a confidence vote will decide the issue one way or the other.