How would you spend your time if you were locked up in the Tower of London on capital charges of treason and corruption? Well, if your name was Samuel Pepys, you'd ask a comely wench to visit you and attempt a bit of how's-your-father through the prison bars. Only the appearance of the warder to escort you to your trial would make you pull up your trousers.
That is the opening scene of a new one-off BBC2 drama, The Private Life of Samuel Pepys, and it pretty much sets the tone for what follows - a decidedly bawdy romp through the pages of perhaps the most famous diary in the English language. As portrayed with a rare twinkle by Steve Coogan (I'm Alan Partridge) in this film, Pepys certainly makes the most of living in what historians call "Merrie England". He is so busy cavorting with various buxom maids, it's a wonder he ever finds the time to write a single diary entry, let alone invent the Royal Navy as Charles II's Secretary of the Admiralty. Like me, you may find yourself feeling exhausted merely watching the amount of roistering Pepys gets up to.
And yet, the writer Guy Jenkin reveals that he actually had to tone down Pepys's sexual exploits for the screen. Taking a break from his steaming keyboard, he says that "the BBC is usually accused of adding lots of sex to its classic adaptations. But if anything, we've had to take it out. In the diaries, there are a lot more encounters with a lot more women than we put in the film. Rather than sexing it up, we've had to sex it down". So just why was the diarist so successful at putting notches on his bed-post? Jenkin smiles. "Let's put it like this, Pepys led a very vivid life.
He was very prolific with women. I imagine he had a certain wit and charm about him. But further than that, sexual mores were very different then. Exchanges between gentlemen and bar maids were common. "He would casually massage the breasts of the maid who brushed his hair at night as though it were the most normal thing in the world. It wasn't exactly prostitution, but like some sort of game. It was the 17th-century equivalent of the casting-couch."
In working his way through the two-feet-high pile of diaries, Jenkin had to decode Pepys' entries about his many dalliances because he "wrote them up in shorthand. As a double safety device, he described his amorous encounters in a mixture of Spanish and Latin."
The diaries are so racy that when they were first published during the Victorian era, they were heavily expurgated. According to Jenkin, they were deemed to be such hot stuff that "when the monarch asked to see the diaries in their unadulterated form, the request was turned down on the grounds of taste and decency." Such revelations are just part and parcel of the uncompromising frankness that distinguishes Pepys' diaries. It is this characteristic, above all others, which convinced Jenkin that this life was ripe for dramatisation. "I love the absolute honesty of his diaries," Jenkin enthuses. "He doesn't re-touch the picture of himself; he isn't concerned with burnishing his own image.
"Pepys describes himself as though he is looking down from above. He is not afraid to put in all his own idiocies. The message from most published diaries is 'aren't I wonderful?' Very few are as unvarnished as Pepys's. In his diaries, he comes across with all his weaknesses."
In particular, he gives a brutally honest portrayal of his marriage. Pepys and his French wife Elizabeth (played by Lou Doillon, a well-known actress in her native land who is both the daughter of Jane Birkin and the sister of Charlotte Gainsbourg) had a turbulent relationship that often spilled over into outright violence. In one of many Francis Urquhart-style asides to camera during the film, Pepys arches an ironic eyebrow as he reflects that "the Bible says women should be meek and obedient. Perhaps they don't have that bit in France".
What emerges most clearly from the drama is a man possessed of that most human of qualities, inconsistency. "I have a real affection for Pepys," Coogan observes. "He was flawed, offensive, funny and principled all at the same time." Jenkin has long specialised in depicting such foibles. The writer, who first came to prominence in the early 1990s as the co-creator of Drop the Dead Donkey, has penned many memorable comedy dramas, including A Very Open Prison, a riotous film about the chaos in our penal institutions, Sex'n'Death, a prescient picture about the viral spread of ever more voyeuristic reality TV shows, and last year's coruscating fantasy about our most colourful peer, Jeffrey Archer: The Truth.
Pepys fits in well with such a gallery of lovable rogues - he is, after all, a mass of contradictions. He could be both a consummate politician and an incompetent husband. "It's very interesting that a man who contributed a great deal towards building the modern Royal Navy and was the most fastidious of civil servants should have been so comic and chaotic in other ways," says Jenkin.
There is, for instance, more than a hint of Alan Partridge-esque hopelessness when Pepys' roving eye causes his wife temporarily to walk out on him. "Other men marry for money and are happy. I marry for love, and she leaves me," the diarist wails - and promptly kicks his dog in frustration.
Even though Coogan is not an obvious choice for a period drama, Jenkin feels that he deftly captures Pepys' contrary nature. "Steve has a wonderful ability to turn on a sixpence," the writer reckons. "I like the way he makes no concessions - he never tries to make his character nicer. He doesn't ingratiate himself with the audience, but he still manages to draw them in and by the end they have grown to like him."
The full-on bonnets and bustles of The Secret Life of Samuel Pepys mark quite a radical change for Jenkin, who is primarily a satirist. However, the writer did not have to check in his trademark wryness before embarking on this costume drama. When, for example, Pepys and one of his countless mistresses are spotted by a passer-by making love on a north London common, his lover reassures him: "don't worry, everyone does it up here in Islington".
As well as providing a piercing insight into Pepys' character, the diaries have also bequeathed to us is "a fascinating picture of home life in the 17th Century", says Jenkin. "People such as Clarendon and Evelyn wrote about the big historical events, but very few captured the tiny details of everyday life. Ninety per cent of our knowledge about British domestic life at that time comes from Pepys." Jenkin has clearly soaked up a lot of the detail himself, telling me with great relish about the fact that nobles in the 17th century wore platform shoes - not as a fashion statement, but in order to remain above the detritus flowing along the gutters.
Jenkin concludes by comparing him with our most celebrated modern-day diarist. "Pepys is absolutely unsparing with himself - in that, he reminds me very much of the late Tory MP Alan Clark. Clark's candour comes from the utter confidence of being an aristocrat and having loads of money; Pepys' comes from an admirable desire to leave behind a true record of his life." So, does he see any other similarities between the 17th-century and 20th-century politicians? Jenkin grins widely before returning one last time to the subject that looms large in both their lives: a voracious sexual appetite. "I think Pepys would have been proud to copy Clark and sleep with three women from the same family!"
'The Private Life of Samuel Pepys', 9pm, tonight, BBC2Reuse content