def set_character_set(self, charset):
if charset in ("<STR_LIT>", "<STR_LIT>"):<EOL><INDENT>py_charset = "<STR_LIT:utf8>"<EOL><DEDENT>else:<EOL><INDENT>py_charset = charset<EOL><DEDENT>if self.character_set_name() != charset:<EOL><INDENT>try:<EOL><INDENT>super(Connection, self).set_character_set(charset)<EOL><DEDENT>except AttributeError:<EOL><INDENT>if self._server_version < (<NUM_LIT:4>, <NUM_LIT:1>):<EOL><INDENT>raise NotSupportedError("<STR_LIT>")<EOL><DEDENT>self.query('<STR_LIT>' % charset)<EOL>self.store_result()<EOL><DEDENT><DEDENT>self.encoding = py_charset<EOL>
Set the connection character set to charset. The character
        set can only be changed in MySQL-4.1 and newer. If you try
        to change the character set from the current value in an
        older version, NotSupportedError will be raised.