def strip_ansi(text, c1=False, osc=False):
text = ansi_csi0_finder.sub('<STR_LIT>', text)<EOL>if osc:<EOL><INDENT>text = ansi_osc0_finder.sub('<STR_LIT>', text)<EOL><DEDENT>if c1:<EOL><INDENT>text = ansi_csi1_finder.sub('<STR_LIT>', text)  <EOL>if osc:<EOL><INDENT>text = ansi_osc1_finder.sub('<STR_LIT>', text)<EOL><DEDENT><DEDENT>return text<EOL>
Strip ANSI escape sequences from a portion of text.
        https://stackoverflow.com/a/38662876/450917

        Arguments:
            line: str
            osc: bool  - include OSC commands in the strippage.
            c1:  bool  - include C1 commands in the strippage.

        Notes:
            Enabling c1 and osc stripping is less efficient and the two options
            can mildly conflict with one another.
            The less problematic order was chosen, so there may still be rare
            C1 OSC fragments left over.