(text)
return len(lines[0]) - n_stripped
Returns indentation for a given ``text``.

    :param text: String, can be multi-line. Only first non-empty line is used to determine the indentation
    :return: Indentation (the number of whitespace characters)
Returns indentation for a given ``text``.
Returns indentation for a given text .
def get_indent(text):
    """
    Returns indentation for a given ``text``.

    :param text: String, can be multi-line. Only first non-empty line is used to determine the indentation
    :return: Indentation (the number of whitespace characters)
    """
    lines = text.split('\n')
    while len(lines) > 0 and lines[0] == '':
        lines.pop(0)

    if len(lines) == 0:
        return 0  # Text was empty, indentation for empty text is 0

    n_stripped = len(lines[0].lstrip())  # Length of the string after stripping whitespaces on the left
    return len(lines[0]) - n_stripped
def get_indent ( text ) : lines = text . split ( '\n' ) while len ( lines ) > 0 and lines [ 0 ] == '' : lines . pop ( 0 ) if len ( lines ) == 0 : return 0 # Text was empty, indentation for empty text is 0 n_stripped = len ( lines [ 0 ] . lstrip ( ) ) # Length of the string after stripping whitespaces on the left return len ( lines [ 0 ] ) - n_stripped