def strip_whitespace(tokens):
    for i, token in enumerate(tokens):
        if token.type != 'S':
            break
    else:
        return []  # only whitespace
    tokens = tokens[i:]
    while tokens and tokens[-1].type == 'S':
        tokens.pop()
    return tokens
Remove whitespace at the beggining and end of a token list.
dataset/ETHPy150Open FichteFoll/CSScheme/tinycsscheme/tinycss/parsing.py/strip_whitespace