code: def set_physical_page_for_file(self, pageId, ocrd_file, order=None, orderlabel=None):
          
          #  print(pageId, ocrd_file)
          # delete any page mapping for this file.ID
          for el_fptr in self._tree.getroot().findall(
                  'mets:structMap[@TYPE="PHYSICAL"]/mets:div[@TYPE="physSequence"]/mets:div[@TYPE="page"]/mets:fptr[@FILEID="%s"]' %
                  ocrd_file.ID, namespaces=NS):
              el_fptr.getparent().remove(el_fptr)
  
          # find/construct as necessary
          el_structmap = self._tree.getroot().find('mets:structMap[@TYPE="PHYSICAL"]', NS)
          if el_structmap is None:
              el_structmap = ET.SubElement(self._tree.getroot(), TAG_METS_STRUCTMAP)
              el_structmap.set('TYPE', 'PHYSICAL')
          el_seqdiv = el_structmap.find('mets:div[@TYPE="physSequence"]', NS)
          if el_seqdiv is None:
              el_seqdiv = ET.SubElement(el_structmap, TAG_METS_DIV)
              el_seqdiv.set('TYPE', 'physSequence')
          el_pagediv = el_seqdiv.find('mets:div[@ID="%s"]' % pageId, NS)
          if el_pagediv is None:
              el_pagediv = ET.SubElement(el_seqdiv, TAG_METS_DIV)
              el_pagediv.set('TYPE', 'page')
              el_pagediv.set('ID', pageId)
              if order:
                  el_pagediv.set('ORDER', order)
              if orderlabel:
                  el_pagediv.set('ORDERLABEL', orderlabel)
          el_fptr = ET.SubElement(el_pagediv, TAG_METS_FPTR)
          el_fptr.set('FILEID', ocrd_file.ID)
docs: Create a new physical page