def join_css_classes(class_list):
 return ' '.join(sorted((str(val) for val in class_list if val)))

def join_css_classes ( class_list ) : return ' ' . join ( sorted ( ( str ( val ) for val in class_list if val ) ) )
join an iterable of truthy values by spaces .