docs: def generate(self, profile, parameters, projectpath, inputfiles, provenancedata=None):
          """Yields (inputtemplate, inputfilename, outputfilename, metadata) tuples"""
  
          project = os.path.basename(projectpath)
  
          if self.parent: #pylint: disable=too-many-nested-blocks
              #We have a parent, infer the correct filename
  
              #copy filename from parent
              parent = self.getparent(profile)
  
              #get input files for the parent InputTemplate
              parentinputfiles = parent.matchingfiles(projectpath)
              if not parentinputfiles:
                  raise Exception("OutputTemplate '"+self.id + "' has parent '" + self.parent + "', but no matching input files were found!")
  
              #Do we specify a full filename?
              for seqnr, inputfilename, inputtemplate in parentinputfiles: #pylint: disable=unused-variable
  
                  if self.filename:
                      filename = self.filename
                      parentfile = CLAMInputFile(projectpath, inputfilename)
                  elif parent:
                      filename = inputfilename
                      parentfile = CLAMInputFile(projectpath, inputfilename)
                  else:
                      raise Exception("OutputTemplate '"+self.id + "' has no parent nor filename defined!")
  
                  #Make actual CLAMInputFile objects of ALL relevant input files, that is: all unique=True files and all unique=False files with the same sequence number
                  relevantinputfiles = []
                  for seqnr2, inputfilename2, inputtemplate2 in inputfiles:
                      if seqnr2 == 0 or seqnr2 == seqnr:
                          relevantinputfiles.append( (inputtemplate2, CLAMInputFile(projectpath, inputfilename2)) )
  
                  #resolve # in filename (done later)
                  #if not self.unique:
                  #    filename.replace('#',str(seqnr))
  
                  if not self.filename and self.removeextensions:
                      #Remove unwanted extensions
                      if self.removeextensions is True:
                          #Remove any and all extensions
                          filename = filename.split('.')[0]
                      elif isinstance(self.removeextensions, list):
                          #Remove specified extension
                          for ext in self.removeextensions:
                              if ext:
                                  if ext[0] != '.' and filename[-len(ext) - 1:] == '.' + ext:
                                      filename = filename[:-len(ext) - 1]
                                  elif ext[0] == '.' and filename[-len(ext):] == ext:
                                      filename = filename[:-len(ext)]
  
  
                  if self.extension and not self.filename and filename[-len(self.extension) - 1:] != '.' + self.extension: #(also prevents duplicate extensions)
                      filename += '.' + self.extension
  
  
                  #Now we create the actual metadata
                  metadata = self.generatemetadata(parameters, parentfile, relevantinputfiles, provenancedata)
  
                  #Resolve filename
                  filename = resolveoutputfilename(filename, parameters, metadata, self, seqnr, project, inputfilename)
  
                  yield inputtemplate, inputfilename, filename, metadata
  
          elif self.unique and self.filename:
              #outputtemplate has no parent, but specified a filename and is unique, this implies it is not dependent on input files:
  
              metadata = self.generatemetadata(parameters, None, [], provenancedata)
  
              filename = resolveoutputfilename(self.filename, parameters, metadata, self, 0, project, None)
  
              yield None, None, filename, metadata
          else:
              raise Exception("Unable to generate from OutputTemplate, no parent or filename specified")