def get_products_from_tiids(tiids, ignore_order=False):
    #  @ignore_order makes it slightly faster by not sorting
    if not tiids:
        return []
        
    unsorted_products = Product.query.filter(Product.tiid.in_(tiids)).all()
    ret = []

    if ignore_order:
        ret = unsorted_products
    else:
        for my_tiid in tiids:
            try:
                my_product = [p for p in unsorted_products if p.tiid == my_tiid][0]
            except __HOLE__:
                continue
            ret.append(my_product)

    return ret
dataset/ETHPy150Open Impactstory/total-impact-webapp/totalimpactwebapp/product.py/get_products_from_tiids