def pairwise(iterable):
    """! s -> (s0,s1), (s2,s3), (s3, s4), ..."""
    r = []
    for x in iterable:
        r.append(x)
        if len(r) == 2:
            yield tuple(r)
            r = []
    if len(r) > 0:
        yield r[0], r[1]
