def format_indent_line(items, spaces, indent, backslash, is_last):
    """Returns elements separated by commas. The line can be indented. This function is for
    internal use and is not available in templates.

    :param list items: a list of items.
    :param int spaces: indentation spaces
    :param bool indent: indent the line
    :param bool backslash: Add backlash (``\\``) to the end
    :param bool is_last: is the last line. If it is True, a comma is not put after
                         the last element. Backlash is also not added
    :return: Items separated by commas
    """
    line = ' ' * spaces if indent else ''
    line += ', '.join(items) + (',' if not backslash or not is_last else '')
    if backslash and not is_last:
        line += ' \\'
    return line
