code: def download_videos(cls, name, test_passed=True, maintain_default=False):
          
          # Exclude first wrapper if the driver must be reused
          driver_wrappers = cls.driver_wrappers[1:] if maintain_default else cls.driver_wrappers
          video_name = '{}_driver{}' if len(driver_wrappers) > 1 else '{}'
          video_name = video_name if test_passed else 'error_{}'.format(video_name)
          driver_index = 1
  
          for driver_wrapper in driver_wrappers:
              if not driver_wrapper.driver:
                  continue
              try:
                  # Download video if necessary (error case or enabled video)
                  if (not test_passed or driver_wrapper.config.getboolean_optional('Server', 'video_enabled', False)) \
                          and driver_wrapper.remote_node_video_enabled:
                      if driver_wrapper.server_type in ['ggr', 'selenoid']:
                          name = get_valid_filename(video_name.format(name, driver_index))
                          Selenoid(driver_wrapper).download_session_video(name)
                      elif driver_wrapper.server_type == 'grid':
                          # Download video from Grid Extras
                          driver_wrapper.utils.download_remote_video(driver_wrapper.remote_node,
                                                                     driver_wrapper.session_id,
                                                                     video_name.format(name, driver_index))
              except Exception as exc:
                  # Capture exceptions to avoid errors in teardown method due to session timeouts
                  driver_wrapper.logger.warn('Error downloading videos: %s' % exc)
              driver_index += 1
docs: Download saved videos if video is enabled or if test fails
  
          :param name: destination file name
          :param test_passed: True if the test has passed
          :param maintain_default: True if the default driver should not be closed