code: def genXML(self):
          
          # Check conditions
          if self.filename is None or \
                  self.foldername is None or \
                  self.imgSize is None:
              return None
  
          top = Element('annotation')
          if self.verified:
              top.set('verified', 'yes')
  
          folder = SubElement(top, 'folder')
          folder.text = self.foldername
  
          filename = SubElement(top, 'filename')
          filename.text = self.filename
  
          if self.localImgPath is not None:
              localImgPath = SubElement(top, 'path')
              localImgPath.text = self.localImgPath
  
          source = SubElement(top, 'source')
          database = SubElement(source, 'database')
          database.text = self.databaseSrc
  
          size_part = SubElement(top, 'size')
          width = SubElement(size_part, 'width')
          height = SubElement(size_part, 'height')
          depth = SubElement(size_part, 'depth')
          width.text = str(self.imgSize[1])
          height.text = str(self.imgSize[0])
          if len(self.imgSize) == 3:
              depth.text = str(self.imgSize[2])
          else:
              depth.text = '1'
  
          segmented = SubElement(top, 'segmented')
          segmented.text = '0'
          return top
docs: Return XML root