'return a set() of constraints for db_name.table_name.column_name'

def lookup_constraint(self, db_name, table_name, column_name=None):

    def _lookup():
        table = self._constraint_cache[db_name][table_name]
        if (table is INVALID):
            raise INVALID
        elif (column_name is None):
            return list(table.items())
        else:
            return table[column_name]
    try:
        ret = _lookup()
        return ret
    except INVALID:
        del self._constraint_cache[db_name][table_name]
        self._fill_constraint_cache(db_name, table_name)
    except KeyError:
        if self._is_valid_cache(db_name, table_name):
            return []
        self._fill_constraint_cache(db_name, table_name)
    return self.lookup_constraint(db_name, table_name, column_name)
