code: def unmount(self, remove_rw=False, allow_lazy=False):
          
  
          for m in list(sorted(self.volumes, key=lambda v: v.mountpoint or "", reverse=True)):
              try:
                  m.unmount(allow_lazy=allow_lazy)
              except ImageMounterError:
                  logger.warning("Error unmounting volume {0}".format(m.mountpoint))
  
          if self._paths.get('nbd'):
              _util.clean_unmount(['qemu-nbd', '-d'], self._paths['nbd'], rmdir=False)
  
          if self.mountpoint:
              try:
                  _util.clean_unmount(['fusermount', '-u'], self.mountpoint)
              except SubsystemError:
                  if not allow_lazy:
                      raise
                  _util.clean_unmount(['fusermount', '-uz'], self.mountpoint)
  
          if self._paths.get('avfs'):
              try:
                  _util.clean_unmount(['fusermount', '-u'], self._paths['avfs'])
              except SubsystemError:
                  if not allow_lazy:
                      raise
                  _util.clean_unmount(['fusermount', '-uz'], self._paths['avfs'])
  
          if self.rw_active() and remove_rw:
              os.remove(self.rwpath)
  
          self.is_mounted = False
docs: Removes all ties of this disk to the filesystem, so the image can be unmounted successfully.
  
          :raises SubsystemError: when one of the underlying commands fails. Some are swallowed.
          :raises CleanupError: when actual cleanup fails. Some are swallowed.