def parse_list_substring(log, list_string):
    """
    Return a list of names
    Examples:
    # Invalid: empty string
    # Invalid: host[10, no closing bracket
    # Invalid: host10], illegal closing bracket
    # Invalid: host[], empty range
    # Invalid: host]1-3[, disordered brackets
    # Invalid: host[A], not a number
    # Invalid: host[10-], nothing after minus
    # Invalid: host[10-A], not a number after minus
    # Invalid: host[0x02], not a number (hexadecimal is not supported)
    # Invalid: host[1-3][1-2], multiple bracket pairs
    # Invalid: host[1-2-3], not a number after minus
    # Invalid: host[0-010], disordered name pattern
    # Invalid: host[10-0], disordered range
    # Invalid: host[-2], nothing before minus
    # Valid: host100
    # Valid: host[12], one host of host12
    # Valid: [10], one host of 10
    # Valid: host[100-100], one host of host100
    # Valid: host[0-100], 101 hosts from host0 to host100
    # Valid: host[001-010], 10 hosts from host001 to host010
    # Valid: [0-10]a, 11 hosts from 0a to 10a
    # Valid: host[0-10]a, 11 hosts from host0a to host10a
    """
    # pylint: disable=too-many-locals,too-many-branches
    # pylint: disable=too-many-statements
    if len(list_string) == 0:
        log.cl_error("invalid [%s]: empty string",
                     list_string)
        return None
    start = list_string.find("[")
    end = list_string.find("]")
    if start == -1 and end == -1:
        return [list_string]
    if start != -1 and end == -1:
        log.cl_error("invalid [%s]: no closing bracket",
                     list_string)
        return None
    if start == -1 and end != -1:
        log.cl_error("invalid [%s]: illegal closing bracket",
                     list_string)
        return None
    if start >= end:
        log.cl_error("invalid [%s]: disordered brackets",
                     list_string)
        return None

    if start + 1 == end:
        log.cl_error("invalid [%s]: empty range",
                     list_string)
        return None

    if start == 0:
        prefix = ""
    else:
        prefix = list_string[:start]

    if len(list_string) == end + 1:
        suffix = ""
    else:
        suffix = list_string[end + 1:]

    suffix_start = suffix.find("[")
    suffix_end = suffix.find("]")
    if suffix_start != -1 or suffix_end != -1:
        log.cl_error("invalid [%s]: multiple bracket pairs",
                     list_string)
        return None

    range_string = list_string[start + 1: end]
    minus = range_string.find("-")
    if minus == -1:
        try:
            number = int(range_string, 10)
        except:
            log.cl_error("invalid [%s]: not a number",
                         list_string)
            return None
        return [prefix + range_string + suffix]

    if minus == 0:
        log.cl_error("invalid [%s]: nothing before minus",
                     list_string)
        return None

    if minus == len(range_string) - 1:
        log.cl_error("invalid [%s]: nothing after minus",
                     list_string)
        return None

    range_start = range_string[:minus]
    range_end = range_string[minus + 1:]
    try:
        start_number = int(range_start, 10)
    except:
        log.cl_error("invalid [%s]: not a number before minus",
                     list_string)
        return None

    try:
        end_number = int(range_end, 10)
    except:
        log.cl_error("invalid [%s]: not a number after minus",
                     list_string)
        return None

    if start_number > end_number:
        log.cl_error("invalid [%s]: disordered range",
                     list_string)
        return None

    if ((range_start[0] == "0" and len(range_start) != 1) or
            (range_end[0] == "0" and len(range_end) != 1)):
        # Need to add 0s in the hostnames
        if len(range_start) != len(range_end):
            log.cl_error("invalid [%s]: disordered name pattern",
                         list_string)
            return None
        width = len(range_start)
    else:
        width = None

    names = []
    number = start_number
    while True:
        if number > end_number:
            break
        index_string = str(number)
        if width is not None:
            index_string = index_string.rjust(width, "0")
        name = prefix + index_string + suffix
        names.append(name)
        number += 1
    return names