code: def get_plugin_and_folder(inputzip=None, inputdir=None, inputfile=None):
      
  
      if (inputzip and inputdir) \
              or (inputzip and inputfile) \
              or (inputdir and inputfile):
          raise MQ2Exception('You must provide either a zip file or a '
                             'directory or an input file as input.')
      if not inputzip and not inputdir and not inputfile:
          raise MQ2Exception('You must provide either a zip file or a '
                             'directory or an input file as input.')
  
      # retrieve input: file, directory, zip
      if inputzip:
          tmp_folder = set_tmp_folder()
          extract_zip(inputzip, tmp_folder)
      elif inputfile:
          tmp_folder = inputfile
      else:
          tmp_folder = inputdir
  
      # retrieve the plugins
      plugins = load('MQ2.plugins', subclasses=PluginInterface)
      LOG.debug('Plugin loaded: %s' % [plugin.name for plugin in plugins])
  
      # keep only the plugins that will work
      plugins = [plugin for plugin in plugins if plugin.is_applicable()]
      LOG.debug('Plugin applicable: %s' % [plugin.name for plugin in plugins])
  
      # keep only the plugins that have the file(s) they need
      if inputfile:
          plugins = [plugin for plugin in plugins
                     if plugin.valid_file(tmp_folder)]
      else:
          plugins = [plugin for plugin in plugins
                     if plugin.get_files(tmp_folder)]
  
      LOG.debug('Plugin w/ valid input: %s' %
                [plugin.name for plugin in plugins])
  
      if len(plugins) > 1:
          raise MQ2Exception('Your dataset contains valid input for '
                             'several plugins.')
      if len(plugins) == 0:
          raise MQ2Exception('Invalid dataset: your input cannot not be '
                             'processed by any of the current plugins.')
      plugin = plugins[0]
      return (plugin, tmp_folder)
docs: Main function.