This is a module I wrote when I was learning python that utilizes the rpis GPIO pins to controll a power switch, it also includes a class to control a web cam to take pictures, and save those pictures in a directory that is given the name of the time the pictue was taken, and then send that picture in an email.