The Master and his Pupil

"The Master and His Pupil" is an English fairy tale collected by Joseph Jacobs in his English Fairy Tales.

[1] A learned man had a book in which he had the knowledge to control demons.

His foolish pupil one day found it open and read a spell from it.

Beelzebub (a demon) appeared and demanded a task from him, or he would strangle him.

At that point, the man, having remembered he left his book unlocked, returned and dispelled Beezlebub.