At this point you can just use parser.error. The TypeError should be raised in the two functions if called incorrectly (which can't happen from this entry point, however, it can if someone writes their own entry point).