code: def indent(elem, level=0):
          
          i = "\n" + level * "  "
          j = "\n" + (level - 1) * "  "
          if len(elem):
              if not elem.text or not elem.text.strip():
                  elem.text = i + "  "
              if not elem.tail or not elem.tail.strip():
                  elem.tail = i
              for subelem in elem:
                  BpmnDiagramGraphExport.indent(subelem, level + 1)
              if not elem.tail or not elem.tail.strip():
                  elem.tail = j
          else:
              if level and (not elem.tail or not elem.tail.strip()):
                  elem.tail = j
          return elem
docs: Helper function, adds indentation to XML output.
  
          :param elem: object of Element class, representing element to which method adds intendation,
          :param level: current level of intendation.