def query(query, ts, **kwargs):
    """
    Perform *query* on the testsuite *ts*.

    Note: currently only 'select' queries are supported.

    Args:
        query (str): TSQL query string
        ts (:class:`delphin.itsdb.TestSuite`): testsuite to query over
        kwargs: keyword arguments passed to the more specific query
            function (e.g., :func:`select`)
    Example:
        >>> list(tsql.query('select i-id where i-length < 4', ts))
        [[142], [1061]]
    """
    queryobj = _parse_query(query)

    if queryobj['querytype'] in ('select', 'retrieve'):
        return _select(
            queryobj['projection'],
            queryobj['tables'],
            queryobj['where'],
            ts,
            mode=kwargs.get('mode', 'list'),
            cast=kwargs.get('cast', True))
    else:
        # not really a syntax error; replace with TSQLError or something
        # when the proper exception class exists
        raise TSQLSyntaxError(queryobj['querytype'] +
                              ' queries are not supported')