Inspired by a true story.
Richard Knight, a friend and University house-mate of the Director had an experience with some similarities. He is a lawyer and appears in the film credits under Special Thanks.
Friends sometimes jokingly referred to him as "Lucky Jim", hence the character name "James".