tests = ['\t\tthis line has two tabs of indention',
    '    this line has four spaces of indention']

def indention(astr):
    return ''.join(itertools.takewhile(str.isspace, astr))
for test_string in tests:
    pass
Grab a line's whitespace/indention with Python