Python binding: translating asserts into exceptions