def _progress_bar(self, width, percent, left="<STR_LIT>", right="<STR_LIT>", fill="<STR_LIT:|>"):
text = left + (width - len(left) - len(right)) * "<STR_LIT:U+0020>" + right<EOL>cutoff = int(round(percent * width))<EOL>text = text[:cutoff].replace("<STR_LIT:U+0020>", fill) + text[cutoff:]<EOL>low_cutoff = int(round(<NUM_LIT> * width))<EOL>med_cutoff = int(round(<NUM_LIT> * width))<EOL>if percent < <NUM_LIT>:<EOL><INDENT>yield <NUM_LIT:2>, text[:cutoff]<EOL>yield <NUM_LIT:0>, text[cutoff:]<EOL><DEDENT>elif percent < <NUM_LIT>:<EOL><INDENT>yield <NUM_LIT:2>, text[:low_cutoff]<EOL>yield <NUM_LIT:3>, text[low_cutoff:cutoff]<EOL>yield <NUM_LIT:0>, text[cutoff:]<EOL><DEDENT>else:<EOL><INDENT>yield <NUM_LIT:2>, text[:low_cutoff]<EOL>yield <NUM_LIT:3>, text[low_cutoff:med_cutoff]<EOL>yield <NUM_LIT:4>, text[med_cutoff:cutoff]<EOL>yield <NUM_LIT:0>, text[cutoff:]<EOL><DEDENT>
Get the green/yellow/red pieces of a text + bar display