add type check on expand callback result
clean-up of expand callback
move structs back into pycligen.c
cleanups