This is the controller software for the Occu-pi, a totally awesome bathroom door sensor. If you use it as the basis for your own Occu-pi you may need to make adjustments to use the GPIO pins to which you've wired your sensors and LEDs.
If you have no idea what I'm talking about, read about the Occu-pi.