from MySQLdb import cursors


def process_dsn(dsn):
	"""
	Take a standard DSN-dict and return the args and
	kwargs that will be passed to the MySQLdb Connection
	constructor.
	
	We use the t.e.adbapi.ConnectionPool kwargs here to
	provide a callback that fixes broken connections,
	and set the default cursorclass.
	"""
	dsn['cursorclass'] = cursors.SSDictCursor
	dsn['override_driver'] = 'MySQLdb'
	dsn['cp_min'] = 1
	dsn['cp_max'] = 1
	dsn['timeout'] = 0
	
	# I'm just not sure whether these make things worse or better
	# dsn['use_unicode'] = True
	# dsn['charset'] = 'utf8'
	return [], dsn