'Custom rows lookup
@param key: the key Field
@param values: the values
@param fields: unused (retained for API compatibility)'

def lookup_rows(self, key, values, fields=[]):

    db = current.db
    table = self.table
    count = len(values)
    if (count == 1):
        query = (key == values[0])
    else:
        query = key.belongs(values)
    rows = db(query).select(table.id, table.name, limitby=(0, count))
    self.queries += 1
    if self.show_org_groups:
        s3db = current.s3db
        ltable = s3db.org_group_team
        gtable = s3db.org_group
        left = gtable.on((ltable.org_group_id == gtable.id))
        group_id = ltable.group_id
        if (count == 1):
            query = (group_id == values[0])
        else:
            query = group_id.belongs(values)
        query &= (ltable.deleted != True)
        org_group_name = gtable.name
        links = db(query).select(group_id, org_group_name, left=left)
        self.queries += 1
        groups = self.org_groups
        for link in links:
            group = link[group_id]
            name = link[org_group_name]
            if name:
                if (group not in groups):
                    groups[group] = [name]
                else:
                    groups[group].append(name)
    return rows
