python/lib/gen_code.py: add input size checks (see #63)