code: def set_parameter(connection, parameter, value, verbose=False):
      
      value = str(value)
      try:
          if not connection.set_parameter(parameter, value):
              raise ValueError("invalid parameter or value")
      except (AttributeError, ValueError) as exc:
          warnings.warn(
              'failed to set {}={!r}: {}'.format(parameter, value, str(exc)),
              io_nds2.NDSWarning)
      else:
          print_verbose(
              '    [{}] set {}={!r}'.format(
                  connection.get_host(), parameter, value),
              verbose=verbose,
          )
docs: Set a parameter for the connection, handling errors as warnings