def METHOD_NAME(self, msg, severity):
    assert severity in ['warning', 'error']
    cache = self._warn_cache if severity == 'warning' else self._error_cache
    source_location, breadcrumbs = self._get_current_trace()
    prefix = f'{self._blue}{source_location}: ' if source_location else ''
    prefix += self._yellow if severity == 'warning' else self._red
    prefix += f'{severity.capitalize()}'
    prefix += f' [{breadcrumbs}]: ' if breadcrumbs else ': '
    msg = prefix + self._clear + str(msg)
    if not self.silent and msg not in cache:
        print(msg, file=sys.stderr)
    cache[msg] += 1