import itertools


def n_leading_spaces(s):
    """Return number of leading spaces of s"""
    return sum(1 for _ in itertools.takewhile(lambda x : x.isspace(), s))
    #6789012345678901234567890123456789012345678901234567890123456789012345