def key_to_metric ( self , key ) : return '' . join ( l if l in string . letters else '_' for l in key )
remove punctuation from python key
Replace all non - letter characters with underscores
def key_to_metric(self, key):
        """Replace all non-letter characters with underscores"""
        return ''.join(l if l in string.letters else '_' for l in key)