code: def detect_volumes(self, single=None):
          
          # prevent adding the same volumes twice
          if self.volumes.has_detected:
              for v in self.volumes:
                  yield v
  
          elif single:
              for v in self.volumes.detect_volumes(method='single'):
                  yield v
  
          else:
              # if single == False or single == None, loop over all volumes
              amount = 0
              try:
                  for v in self.volumes.detect_volumes():
                      amount += 1
                      yield v
              except ImageMounterError:
                  pass  # ignore and continue to single mount
  
              # if single == None and no volumes were mounted, use single_volume
              if single is None and amount == 0:
                  logger.info("Detecting as single volume instead")
                  for v in self.volumes.detect_volumes(method='single', force=True):
                      yield v
docs: Generator that detects the volumes from the Disk, using one of two methods:
  
          * Single volume: the entire Disk is a single volume
          * Multiple volumes: the Disk is a volume system
  
          :param single: If *single* is :const:`True`, this method will call :Func:`init_single_volumes`.
                         If *single* is False, only :func:`init_multiple_volumes` is called. If *single* is None,
                         :func:`init_multiple_volumes` is always called, being followed by :func:`init_single_volume`
                         if no volumes were detected.