Python function to generate a text progress bar