Fixed 20221 -- Functions with mark_safe() should result in SafeText

Move those import to the top of the file.