unix wc | tail commands in python