'Returns table entry associated with a col/val pair.'

def get_entries(self, query_attr, query_val, return_attr, default=None, limit=None):

    query_col = self.columns.get(query_attr, None)
    if (query_col is None):
        return default
    if (return_attr is not None):
        return_col = self.columns.get(return_attr, None)
        if (return_col is None):
            return default
    rval = []
    for fields in self.get_fields():
        if (fields[query_col] == query_val):
            if (return_attr is None):
                field_dict = {}
                for (i, col_name) in enumerate(self.get_column_name_list()):
                    field_dict[(col_name or i)] = fields[i]
                rval.append(field_dict)
            else:
                rval.append(fields[return_col])
            if ((limit is not None) and (len(rval) == limit)):
                break
    return (rval or default)
