docs: def load_stims(source, dtype=None, fail_silently=False):
      """ Load one or more stimuli directly from file, inferring/extracting
      metadata as needed.
  
      Args:
          source (str or list): The location to load the stim(s) from. Can be
              the path to a directory, to a single file, or a list of filenames.
          dtype (str): The type of stim to load. If dtype is None, relies on the
              filename extension for guidance. If dtype is provided, must be
              one of 'video', 'image', 'audio', or 'text'.
          fail_silently (bool): If True do not raise error when trying to load a
              missing stimulus from a list of sources.
  
      Returns: A list of Stims.
      """
      from .video import VideoStim, ImageStim
      from .audio import AudioStim
      from .text import TextStim
  
      if isinstance(source, string_types):
          return_list = False
          source = [source]
      else:
          return_list = True
  
      stims = []
  
      stim_map = {
          'image': ImageStim,
          'video': VideoStim,
          'text': TextStim,
          'audio': AudioStim
      }
  
      def load_file(source):
          source = realpath(source)
          import magic  # requires libmagic, so import here
          mime = magic.from_file(source, mime=True)
          if not isinstance(mime, string_types):
              mime = mime.decode('utf-8')
          mime = mime.split('/')[0]
          if mime in stim_map.keys():
              s = stim_map[mime](source)
              stims.append(s)
  
      def load_url(source):
          try:
              main_type = urlopen(source).info().get_content_maintype()  # Py3
          except:
              main_type = urlopen(source).info().getmaintype()  # Py2
          if main_type in stim_map.keys():
              s = stim_map[main_type](url=source)
              stims.append(s)
  
      for s in source:
          if bool(urlparse(s).scheme):
              load_url(s)
          elif isdir(s):
              for f in glob(join(s, '*')):
                  if isfile(f):
                      load_file(f)
          elif isfile(s):
              load_file(s)
          else:
              if not (return_list and fail_silently):
                  raise IOError("File not found")
  
      if return_list:
          return stims
  
      return stims[0]