unix, py: Clean up includes.

Removed many unnecessary system header includes and added a few to improve portability.

I used [esr](http://www.catb.org/esr/)'s [deheader](http://www.catb.org/esr/deheader/).