code: def set_auto_discard_for_device(self, name, controller_port, device, discard):
          
          if not isinstance(name, basestring):
              raise TypeError("name can only be an instance of type basestring")
          if not isinstance(controller_port, baseinteger):
              raise TypeError("controller_port can only be an instance of type baseinteger")
          if not isinstance(device, baseinteger):
              raise TypeError("device can only be an instance of type baseinteger")
          if not isinstance(discard, bool):
              raise TypeError("discard can only be an instance of type bool")
          self._call("setAutoDiscardForDevice",
                       in_p=[name, controller_port, device, discard])
docs: Sets a flag in the device information which indicates that the medium
          supports discarding unused blocks (called trimming for SATA or unmap
          for SCSI devices) .This may or may not be supported by a particular drive,
          and is silently ignored in the latter case. At the moment only hard disks
          (which is a misnomer in this context) accept this setting. Changing the
          setting while the VM is running is forbidden. The device must already
          exist; see :py:func:`IMachine.attach_device`  for how to attach a new
          device.
          
          The @a controllerPort and @a device parameters specify the device slot and
          have have the same meaning as with :py:func:`IMachine.attach_device` .
  
          in name of type str
              Name of the storage controller.
  
          in controller_port of type int
              Storage controller port.
  
          in device of type int
              Device slot in the given port.
  
          in discard of type bool
              New value for the discard device flag.
  
          raises :class:`OleErrorInvalidarg`
              SATA device, SATA port, SCSI port out of range.
          
          raises :class:`VBoxErrorInvalidObjectState`
              Attempt to modify an unregistered virtual machine.
          
          raises :class:`VBoxErrorInvalidVmState`
              Invalid machine state.