I know you didn't write this (or at least it's not from this PR), but I really dislike asserts like this. They raise useless errors, and they are not consistently executed by python. Do you mind checking explicitely, and raising an issue if necessary ?