def penalty_string(distance, limit=None):
 penalties = []
 for key in distance.keys():
  key = key.replace('album_', '')
  key = key.replace('track_', '')
  key = key.replace('_', ' ')
  penalties.append(key)
 if penalties:
  if (limit and (len(penalties) > limit)):
   penalties = (penalties[:limit] + ['...'])
  return ui.colorize('text_warning', (u'(%s)' % ', '.join(penalties)))

def penalty_string ( distance , limit = None ) : penalties = [ ] for key in distance . keys ( ) : key = key . replace ( 'album_' , '' ) key = key . replace ( 'track_' , '' ) key = key . replace ( '_' , ' ' ) penalties . append ( key ) if penalties : if ( limit and ( len ( penalties ) > limit ) ) : penalties = ( penalties [ : limit ] + [ '...' ] ) return ui . colorize ( 'text_warning' , ( u'(%s)' % ', ' . join ( penalties ) ) )
returns a colorized string that indicates all the penalties applied to a distance object .