'Convert a list of integers to a nicer "range like" string. Assumed
that `seq` elems are ordered.
@see test_info.py'

def _convert_to_range(self, seq):

    first = last = seq[0]
    dist = 0
    res = []
    last_in_seq = seq[(-1)]
    is_last_in_seq = (lambda num: (num == last_in_seq))
    for num in seq[1:]:
        is_new_seq = (num != (last + 1))
        if is_new_seq:
            if dist:
                res.append((_('%s    to    %s') % (first, last)))
            else:
                res.append(first)
            if is_last_in_seq(num):
                res.append((_('and') + ('    %s' % num)))
                break
            dist = 0
            first = num
        else:
            if is_last_in_seq(num):
                res.append((_('%s    to    %s') % (first, num)))
                break
            dist += 1
        last = num
    res_str = ',    '.join((str(ele) for ele in res))
    return res_str.replace((',    ' + _('and')), '    and')
