Method which converts the object instance, its attributes and children to a string of lilypond code

        :return: str of lilypond code

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 = ""
        left_barline = self.GetBarline("left")
        other_lefts = self.GetBarline("left-1")
        if other_lefts is not None:
            for left in other_lefts:
                lilystring += left.toLily()

        if left_barline is not None:
            lilystring += left_barline.toLily()

        lilystring += self.HandleAttributes()
        voices = self.GetChildrenIndexes()

        if not hasattr(self, "value"):
            self.value = self.GetTotalValue()
        if len(voices) > 1:
            lilystring += "<<"
        for voice in voices:
            mid_barline = self.GetBarline("middle")
            v_obj = self.getVoice(voice)
            v_obj.autoBeam = self.autoBeam
            if mid_barline is not None:
                v_obj.mid_barline = mid_barline[0]
            v_obj.total = self.value
            if len(voices) > 1:
                lilystring += " % voice " + str(voice) + "\n"
                lilystring += "\\new Voice = \"" + \
                    helpers.NumbersToWords(voice) + "\"\n"
                lilystring += "{\\voice" + \
                    helpers.NumbersToWords(voice).capitalize() + " "
            lilystring += v_obj.toLily()
            if len(voices) > 1:
                lilystring += "}"
        if len(voices) > 1:
            lilystring += ">>"
        lilystring += self.HandleClosingAttributes()
        right_barline = self.GetBarline("right")
        other_rights = self.GetBarline("right-1")
        if other_rights is not None:
            for right in other_rights:
                lilystring += right.toLily()

        if right_barline is not None:
            lilystring += right_barline.toLily()
        else:
            lilystring += " | "
        return lilystring