def is_sorted( s, strict = True ):
    """Test if a sequence is sorted"""

    prev_elem = None
    for x in s:
        if prev_elem != None and x < prev_elem or ( x == prev_elem and strict ):
            return False
        prev_elem = x
    return True