code: def parse_range_pairs(s, range_separator = '-', convert_to_tuple = True):
      ''' Based on parse_range but instead returns a list of lists with the ranges. A single index n is returned as a range (n, n)
          whereas a range m-n is returned as (m, n) if m <= n, else (n, m).
      '''
      result = map(sorted,
         map(lambda r:
              (int(r.split(range_separator)[0]), int(r.split(range_separator)[1])) if range_separator in r
              else (int(r), int(r)),
              s.split(',')))
      if convert_to_tuple:
          return tuple(map(tuple, result))
      return resulf parse_range_pairs(s, range_separator = '-', convert_to_tuple = True):
      ''' Based on parse_range but instead returns a list of lists with the ranges. A single index n is returned as a range (n, n)
          whereas a range m-n is returned as (m, n) if m <= n, else (n, m).
      '''
      result = map(sorted,
         map(lambda r:
              (int(r.split(range_separator)[0]), int(r.split(range_separator)[1])) if range_separator in r
              else (int(r), int(r)),
              s.split(',')))
      if convert_to_tuple:
          return tuple(map(tuple, result))
      return result
docs: Based on parse_range but instead returns a list of lists with the ranges. A single index n is returned as a range (n, n)
          whereas a range m-n is returned as (m, n) if m <= n, else (n, m).