1) This function needs a comment to explain the logic above, otherwise it will become a maintenance nightmare.
2) The docstring is not updated. It says that this is a generator yielding 8-tuples, but it's actually generating 9-tuples.