import io


def is_seq(seq):
    """Test if `seq` is some kind of sequence, based on calling iter(seq), i.e.
    if the object is iterable.

    Exclude cases which are iterable but that we still don't like (string, file
    object). In fact, we wish to catch list, tuple, numpy array.

    Parameters
    ----------
    seq : (nested) sequence of arbitrary objects
    """
    if isinstance(seq, str) or \
       isinstance(seq, io.IOBase):
       return False
    else:
        try:
            x=iter(seq)
            return True
        except:
            return False