docs: def generatemetadata(self, parameters, parentfile, relevantinputfiles, provenancedata = None):
          """Generate metadata, given a filename, parameters and a dictionary of inputdata (necessary in case we copy from it)"""
          assert isinstance(provenancedata,CLAMProvenanceData) or provenancedata is None
  
          data = {}
  
          if self.copymetadata:
              #Copy parent metadata
              for key, value in parentfile.metadata.items():
                  data[key] = value
  
          for metafield in self.metafields:
              if isinstance(metafield, ParameterCondition):
                  metafield = metafield.evaluate(parameters)
                  if not metafield:
                      continue
              assert isinstance(metafield, AbstractMetaField)
              metafield.resolve(data, parameters, parentfile, relevantinputfiles)
  
          if provenancedata:
              data['provenance'] = provenancedata
  
          return self.formatclass(None, **data)