<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_attributes(self, attrs):
 """ Create new style and output. :param attrs: `Attrs` instance. """

        if self.true_color() and not self.ansi_colors_only():
            self.write_raw(self._escape_code_cache_true_color[attrs])
        else:
            self.write_raw(self._escape_code_cache[attrs])