assert create_range_string([1, 2, 3, 4, 6, 7, 8, 9, 12, 13, 19, 20, 22, 22,
    22, 23, 40, 44]) == '1-4,6-9,12-13,19-20,22-23,40,44'
Pythonic way to convert a list of integers into a string of comma-separated ranges