Trains going through a tunnel

In movies, a train going through a tunnel always seems to have carriage lights flicker on and off.

I don’t know why – every train I’ve been in the lights are always on (whether it’s daytime or night).

And what would cause a short in the power to make the lights flicker?
If the train is electric then why would going through a tunnel cause a short and flicker?
And if the train is diesel powered (as is, in fact, usually the case in the movies)… well, then I still ask the same question.