python script to patch away new and empty lines