def to_label(name, capitalize=True):
 label = name.replace('_', ' ')
 if capitalize:
  label = label.capitalize()
 return label

def to_label ( name , capitalize = True ) : label = name . replace ( '_' , ' ' ) if capitalize : label = label . capitalize ( ) return label
converts name into label by replacing underscores by spaces .