Fixed #21852 -- Make migration writer serialize iterables

https://code.djangoproject.com/ticket/21852