Style: I would have yield in every member of the ifelifblock to avoid one level of indirection.

Also this would avoid a bug: you are always yield but you don't have an else clause, so, if no if/elif match, you would yield the previous value.