def get_list_string(var_name, list_obj, ncols=5):
    """ Function to get string format of a list object.

    :param var_name: name of variable
    :type var_name: str

    :param list_obj: object of squence variable
    :type list_obj: list

    :param ncols: number of columns, default is 5
    :type ncols: int

    Example::
        >>> a = [(1,2,3), (2,3,4)]
        >>> get_list_string('a', a)
        >>> 'a = [\\n    (1, 2, 3),\\n    (2, 3, 4),\\n]\\n\\n'
    """
    begin = var_name + ' = ['
    indent = ' ' * 4
    data = ''
    for idx, elem in enumerate(list_obj):
        if hasattr(elem, '__iter__'):
            data += '\n' + indent + str(elem) + ','
            continue
        if idx % ncols == 0:
            data += '\n' + indent
        if isinstance(elem, str):
            data += "'" + elem + "', "
        else:
            data += str(elem) + ', '
    end = '\n]\n\n'
    content = begin + data + end
    return content
