Simple flashlight script like the one in Slenderman?

How would I go about making a simple flashlight script that would make it so that the flashlight would go out after a certain amount of time and would turn back on after a certain amount of time. A slender effect. And preferably for unity 5.1 + because the light component is different in earlier versions.

Add a timer or a coroutine.

Unity Tutorials - DeltaTime

Unity Script Reference - DeltaTime

Unity Answers - Timer

Unity Answers - Coroutine

Unity Manual - Coroutine

Unity Tutorials - Coroutine