consolidate and fix python 2.7 stdin and module types