def get_charset_intervals(charset):
    """
    Given a charset, returns a list of INCLUSIVE (i.e. [a,b] in mathematical noation)
    intervals relative to the ascii table.
    For example, inserting 0123456789ABCDEFabcdef, the returned list will be
    [(48, 57), (65, 70), (97, 102)]

    :param charset: the charset as a string
    :return: a list of intervals
    :rtype: list
    """
    charset_set_list = sorted(set(charset), key=lambda char: ord(char))
    if len(charset_set_list) < 1:
        return None
    if len(charset_set_list) == 1:
        return [ord(charset[0])]

    left_index = ord(charset_set_list[0])
    latest_index = left_index
    intervals = []
    for c in charset_set_list[1:]:
        if ord(c) != (latest_index + 1):
            intervals.append((left_index, latest_index))
            left_index = ord(c)
        latest_index = ord(c)
    intervals.append((left_index, latest_index))
    return intervals