Alyssa/add wire support

this block of logic looks to be shared between wire_gen.py and protobuf_gen.py too.