'Execute a sql.ClauseElement object.'

def _execute_clauseelement(self, elem, multiparams, params):

    if (self._has_events or self.engine._has_events):
        for fn in self.dispatch.before_execute:
            (elem, multiparams, params) = fn(self, elem, multiparams, params)
    distilled_params = _distill_params(multiparams, params)
    if distilled_params:
        keys = distilled_params[0].keys()
    else:
        keys = []
    dialect = self.dialect
    if ('compiled_cache' in self._execution_options):
        key = (dialect, elem, tuple(keys), (len(distilled_params) > 1))
        if (key in self._execution_options['compiled_cache']):
            compiled_sql = self._execution_options['compiled_cache'][key]
        else:
            compiled_sql = elem.compile(dialect=dialect, column_keys=keys, inline=(len(distilled_params) > 1))
            self._execution_options['compiled_cache'][key] = compiled_sql
    else:
        compiled_sql = elem.compile(dialect=dialect, column_keys=keys, inline=(len(distilled_params) > 1))
    ret = self._execute_context(dialect, dialect.execution_ctx_cls._init_compiled, compiled_sql, distilled_params, compiled_sql, distilled_params)
    if (self._has_events or self.engine._has_events):
        self.dispatch.after_execute(self, elem, multiparams, params, ret)
    return ret
