def _color(self, level):
        '''
        Get a color (terminal escape sequence) according to a level.
        '''
        if not sys.stdout.isatty():
            return ''
        elif level < Level.DEBUG:
            return ''
        elif Level.DEBUG <= level < Level.LOWINFO:
            return Color.YELLOW
        elif Level.LOWINFO <= level < Level.INFO:
            return Color.BLUE
        elif Level.INFO <= level < Level.WARNING:
            return Color.GREEN
        elif Level.WARNING <= level < Level.ERROR:
            return Color.MAGENTA
        elif Level.ERROR <= level:
            return Color.RED
dataset/ETHPy150Open anishathalye/dotbot/dotbot/messenger/messenger.py/Messenger._color/original