code: def order_categories(unordered_cats):
    '''
    If categories are strings, then simple ordering is fine.
    If categories are values then I'll need to order based on their values.
    The final ordering is given as the original categories (including titles) in a
    ordered list.
    '''
  
    no_titles = remove_titles(unordered_cats)
  
    all_are_numbers = check_all_numbers(no_titles)
  
    if all_are_numbers:
      ordered_cats = order_cats_based_on_values(unordered_cats, no_titles)
    else:
      ordered_cats = sorted(unordered_cats)
  
    return ordered_catf order_categories(unordered_cats):
    '''
    If categories are strings, then simple ordering is fine.
    If categories are values then I'll need to order based on their values.
    The final ordering is given as the original categories (including titles) in a
    ordered list.
    '''
  
    no_titles = remove_titles(unordered_cats)
  
    all_are_numbers = check_all_numbers(no_titles)
  
    if all_are_numbers:
      ordered_cats = order_cats_based_on_values(unordered_cats, no_titles)
    else:
      ordered_cats = sorted(unordered_cats)
  
    return ordered_cats
docs: If categories are strings, then simple ordering is fine.
    If categories are values then I'll need to order based on their values.
    The final ordering is given as the original categories (including titles) in a
    ordered list.