code: def add_file(self, fileGrp, mimetype=None, url=None, ID=None, pageId=None, force=False, local_filename=None, **kwargs):
          
          if not ID:
              raise Exception("Must set ID of the mets:file")
          el_fileGrp = self._tree.getroot().find(".//mets:fileGrp[@USE='%s']" % (fileGrp), NS)
          if el_fileGrp is None:
              el_fileGrp = self.add_file_group(fileGrp)
          if ID is not None and self.find_files(ID=ID) != []:
              if not force:
                  raise Exception("File with ID='%s' already exists" % ID)
              mets_file = self.find_files(ID=ID)[0]
          else:
              mets_file = OcrdFile(ET.SubElement(el_fileGrp, TAG_METS_FILE), mets=self)
          mets_file.url = url
          mets_file.mimetype = mimetype
          mets_file.ID = ID
          mets_file.pageId = pageId
          mets_file.local_filename = local_filename
  
          self._file_by_id[ID] = mets_file
  
          return mets_file
docs: Add a `OcrdFile </../../ocrd_models/ocrd_models.ocrd_file.html>`_.
  
          Arguments:
              fileGrp (string): Add file to ``mets:fileGrp`` with this ``USE`` attribute
              mimetype (string):
              url (string):
              ID (string):
              pageId (string):
              force (boolean): Whether to add the file even if a ``mets:file`` with the same ``ID`` already exists.
              local_filename (string):
              mimetype (string):