'Returns the indent level of the specified line.
:param line_nbr: Number of the line to get indentation (1 base).
Pass None to use the current line number. Note that you can also
pass a QTextBlock instance instead of an int.
:return: Number of spaces that makes the indentation level of the
current line'

def line_indent(self, line_nbr=None):

    if (line_nbr is None):
        line_nbr = self.current_line_nbr()
    elif isinstance(line_nbr, QTextBlock):
        line_nbr = line_nbr.blockNumber()
    line = self.line_text(line_nbr)
    indentation = (len(line) - len(line.lstrip()))
    return indentation
