def is_sequence(arg):
    """
    Returns true if arg behaves like a sequence,
    unless it also implements strip, such as strings.
    """

    return (not hasattr(arg, "strip") and
            hasattr(arg, "__getitem__") or
            hasattr(arg, "__iter__"))