docs: def find_files(self, ID=None, fileGrp=None, pageId=None, mimetype=None, url=None, local_only=False):
          """
          Search ``mets:file`` in this METS document.
  
          Args:
              ID (string) : ID of the file
              fileGrp (string) : USE of the fileGrp to list files of
              pageId (string) : ID of physical page manifested by matching files
              url (string) : @xlink:href of mets:Flocat of mets:file
              mimetype (string) : MIMETYPE of matching files
              local (boolean) : Whether to restrict results to local files, i.e. file://-URL
  
          Return:
              List of files.
          """
          ret = []
          fileGrp_clause = '' if fileGrp is None else '[@USE="%s"]' % fileGrp
          file_clause = ''
          if ID is not None:
              file_clause += '[@ID="%s"]' % ID
          if mimetype is not None:
              file_clause += '[@MIMETYPE="%s"]' % mimetype
          if url is not None:
              file_clause += '[mets:FLocat[@xlink:href = "%s"]]' % url
          # TODO lxml says invalid predicate. I disagree
          #  if local_only:
          #      file_clause += "[mets:FLocat[starts-with(@xlink:href, 'file://')]]"
  
          # Search
          file_ids = self._tree.getroot().xpath("//mets:fileGrp%s/mets:file%s/@ID" % (fileGrp_clause, file_clause), namespaces=NS)
          if pageId is not None:
              by_pageid = self._tree.getroot().xpath('//mets:div[@TYPE="page"][@ID="%s"]/mets:fptr/@FILEID' % pageId, namespaces=NS)
              file_ids = [i for i in by_pageid if i in file_ids]
  
          # instantiate / get from cache
          for file_id in file_ids:
              el = self._tree.getroot().find('.//mets:file[@ID="%s"]' % file_id, NS)
              if file_id not in self._file_by_id:
                  self._file_by_id[file_id] = OcrdFile(el, mets=self)
  
              # If only local resources should be returned and file is neither a
              # file:// URL nor a file path: skip the file
              url = self._file_by_id[file_id].url
              if local_only and not (url.startswith('file://') or '://' not in url):
                  continue
              ret.append(self._file_by_id[file_id])
          return ret