human
Complete the below
def invalidate_table_constraints(func):

    ''''For MySQL we grab all table constraints simultaneously, so this is
    effective.
    It further solves the issues of invalidating referred table constraints.'
    '''
 Can you provide a the Python code you requested?
assistant
#Here is the Python code you requested.
    def _cache_clear(self, table, *args, **opts):
        db_name = self._get_setting('NAME')
        if (db_name in self._constraint_cache):
            del self._constraint_cache[db_name]
        if (db_name in self._reverse_cache):
            del self._reverse_cache[db_name]
        if (db_name in self._constraint_references):
            del self._constraint_references[db_name]
        return func(self, table, *args, **opts)
    return _cache_clear