def set_parameter(connection, parameter, value, verbose=False):
value = str(value)<EOL>try:<EOL><INDENT>if not connection.set_parameter(parameter, value):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT><DEDENT>except (AttributeError, ValueError) as exc:<EOL><INDENT>warnings.warn(<EOL>'<STR_LIT>'.format(parameter, value, str(exc)),<EOL>io_nds2.NDSWarning)<EOL><DEDENT>else:<EOL><INDENT>print_verbose(<EOL>'<STR_LIT>'.format(<EOL>connection.get_host(), parameter, value),<EOL>verbose=verbose,<EOL>)<EOL><DEDENT>
Set a parameter for the connection, handling errors as warnings