  def DetachDisk(self, disk: 'GoogleComputeDisk') -> None:
    """Detach a disk from the virtual machine.

    Args:
      disk (GoogleComputeDisk): Disk to detach.
    """

    gce_instance_client = self.GceApi().instances() # pylint: disable=no-member
    device_name = None
    for disk_dict in self.GetValue('disks'):
      if disk_dict.get('source', '').split('/')[-1] == disk.name:
        device_name = disk_dict['deviceName']
    request = gce_instance_client.detachDisk(
        instance=self.name,
        project=self.project_id,
        zone=self.zone,
        deviceName=device_name)
    response = request.execute()
    self.BlockOperation(response, zone=self.zone)
Detach a disk from the virtual machine.

Args:
disk (GoogleComputeDisk): Disk to detach.
libcloudforensics/providers/gcp/internal/compute.py