def query(modelclass, filt=None, columns=None, order_by=None, start=None, end=None):
    try:
        order_by = order_by and modelclass.ROW_DISPLAY[0]
    except AttributeError:
        pass
    # select only columns if list of column names is provided.
    if columns is None:
        q = dbsession.query(modelclass)
    else:
        attrlist = [getattr(modelclass, n) for n in columns]
        q = dbsession.query(*attrlist)
    # build filter if one is provided as a dictionary
    if filt is not None:
        for name, value in filt.items():
            attrib = getattr(modelclass, name)
            q = q.filter(attrib==value)
    if order_by:
        q = q.order_by(getattr(modelclass, order_by))

    if end is not None:
        if start is not None:
            q = q.slice(start, end)
        else:
            q = q.limit(end)
    return q.all()


### update a row ###

# updates a row from javascript/json object
dataset/ETHPy150Open kdart/pycopia/storage/pycopia/db/webhelpers.py/query/operator `or` -> `and`