Fixed #20977 -- Allows writing migrations to disk on Python 3