docs: def toLily(self):
          '''
          Method which converts the object instance, its attributes and children to a string of lilypond code
  
          :return: str of lilypond code
          '''
  
          lilystring = ""
          children = self.GetChildrenIndexes()
          total = self.note_total
          counter = 0
          for child in range(len(children)):
              note = self.GetChild(children[child])
              item = note.GetItem()
              if item is not None:
                  item.autoBeam = self.autoBeam
              if hasattr(note, "duration"):
                  try:
                      counter += int(note.duration)
                  except:
                      if note.duration == "\\longa":
                          counter += 0.25
                      if note.duration == "\\breve":
                          counter += 0.5
              if counter > total / 2:
                  if hasattr(self, "mid_barline"):
                      lilystring += self.mid_barline.toLily()
                      self.__delattr__("mid_barline")
              if hasattr(self, "rest") and hasattr(self, "total"):
                  lilystring += "R" + self.total
              else:
                  lilystring += note.toLily() + " "
          return lilystring