code: def set_atten(self, idx, value):
          
          if not self.is_open:
              raise attenuator.Error(
                  "Connection to attenuator at %s is not open!" %
                  self._telnet_client.host)
          if idx + 1 > self.path_count:
              raise IndexError("Attenuator index out of range!", self.path_count,
                               idx)
          if value > self.max_atten:
              raise ValueError("Attenuator value out of range!", self.max_atten,
                               value)
          # The actual device uses one-based index for channel numbers.
          self._telnet_client.cmd("CHAN:%s:SETATT:%s" % (idx + 1, value))
docs: Sets the attenuation value for a particular signal path.
  
          Args:
              idx: Zero-based index int which is the identifier for a particular
                  signal path in an instrument. For instruments that only has one
                  channel, this is ignored by the device.
              value: A float that is the attenuation value to set.
  
          Raises:
              Error: The underlying telnet connection to the instrument is not
                  open.
              IndexError: The index of the attenuator is greater than the maximum
                  index of the underlying instrument.
              ValueError: The requested set value is greater than the maximum
                  attenuation value.