Traffic lights are signaling devices positioned at road intersections, pedestrian crossings, and other locations to control flows of traffic. Traffic lights alternate the right way accorded to users by displaying lights of a standard color (red, orange and green) following a universal color code.

In the typical sequence of color phases:
The green light allows traffic to proceed in the direction denoted, if it is safe to do so and there is room on the other side of the intersection.
The orange light warns that the signal is about to change to red. Actions required by drivers on a orange light vary, with some jurisdictions requiring drivers to stop if it is safe to do so, and others allowing drivers to go through the intersection if safe to do so.
The red signal prohibits any traffic from proceeding.
Define a class TrafficLight that can be used to represent traffic lights. At any point in time, each traffic light is in one of three possible states: red, orange or green.
When creating a new traffic light (TrafficLight), the initial state of the traffic light (str; default value: red) can be passed. The only possible states are red, orange and green (lowercase).
If a traffic light $$t$$ (TrafficLight) is passed to the built-in function str, the current state (str) of traffic light $$t$$ must be returned.
If a traffic light $$t$$ (TrafficLight) is passed to the built-in function repr, a string representation (str) of traffic light $$t$$ must be returned that reads as a Python expression to create a new traffic light (TrafficLight) whose initial state is set to the current state of traffic light $$t$$.
It must be possible to call method next on a traffic light $$t$$ (TrafficLight). The method takes no arguments and always returns the value None, but puts traffic light $$t$$ in its next state: after red comes green, after green comes orange, and after orange comes red.
>>> light1 = TrafficLight()
>>> light1
TrafficLight('red')
>>> light2 = TrafficLight('green')
>>> print(light1, light2)
red green
>>> light1.next()
>>> print(light1, light2)
green green
>>> light1.next()
>>> light1.next()
>>> light2.next()
>>> print(light1, light2)
red orange