The Master and Margarita

From Tardis Wiki, the free Doctor Who reference
The Master and Margarita
You may be looking for the short story.

The Master and Margarita was a novel by Mikhail Bulgakov. One of its characters is a version of the Devil, who owns a small house with an infinite number of rooms. The Third Doctor told Sarah Jane Smith that this character was based on him; it was the first time that he had been used as a political metaphor and he wasn't sure that he liked it. (PROSE: Interference - Book One)