misc text munging python hacks