Retrieve valid passages directly

        :param level: Depth required. If not set, should retrieve first encountered level (1 based)
        :type level: int
        :param reference: CapitainsCtsPassage Reference
        :type reference: CtsReference
        :param _debug: Check on passages duplicates
        :type _debug: bool
        :returns: List of levels

        .. note:: GetValidReff works for now as a loop using CapitainsCtsPassage, subinstances of CtsTextMetadata, to retrieve the valid \
        informations. Maybe something is more powerfull ?

def getValidReff(self, level: int=1, reference: CtsReference=None, _debug: bool=False) -> CtsReferenceSet:
        """ Retrieve valid passages directly

        :param level: Depth required. If not set, should retrieve first encountered level (1 based)
        :type level: int
        :param reference: CapitainsCtsPassage Reference
        :type reference: CtsReference
        :param _debug: Check on passages duplicates
        :type _debug: bool
        :returns: List of levels

        .. note:: GetValidReff works for now as a loop using CapitainsCtsPassage, subinstances of CtsTextMetadata, to retrieve the valid \
        informations. Maybe something is more powerfull ?
        """

        depth = 0
        xml = self.textObject.xml

        if reference:
            if isinstance(reference, CtsReference):
                if not reference.is_range():
                    passages = [reference.start.list]
                    depth = len(passages[0])
                    if level == 0:
                        level = None
                        if _debug:
                            warnings.warn("Using level=0 with a Non-range Reference is invalid. Autocorrected to 1")
                else:
                    xml = self.getTextualNode(subreference=reference)

                    common = []

                    for index, part in enumerate(reference.start.list):
                        if index <= reference.end.depth:
                            if part == reference.end.list[index]:
                                common.append(part)
                            else:
                                break
                        else:
                            break

                    passages = [common]
                    depth = len(common)

                    if level is None:
                        level = reference.start.depth + depth
                    elif level == 1:
                        level = reference.start.depth + 1
                    elif level == 0:
                        level = reference.start.depth
            else:
                raise TypeError()
        else:
            passages = [[]]

        if level is None:
            level = 1

        if level <= len(passages[0]) and reference is not None:
            level = len(passages[0]) + 1
        if level > len(self.citation.root):
            raise CitationDepthError("The required level is too deep")

        nodes = [None] * (level - depth)

        citations = [citation for citation in self.citation.root]

        while len(nodes) >= 1:
            passages = [
                refs + [node.get(current_citation.attribute.replace("xml:", "{http://www.w3.org/XML/1998/namespace}"))]
                for xpath_result, refs, current_citation in [
                        (
                            xml.xpath(
                                citations[len(filling)-1].fill(filling),
                                namespaces=XPATH_NAMESPACES
                            ),
                            refs,
                            citations[len(filling)-1]
                        )
                        for filling, refs in
                        [(refs + [None], refs) for refs in passages]
                    ]
                for node in xpath_result
            ]
            nodes.pop(0)

            if len(passages) == 0:
                msg = "Unknown reference {}".format(reference)
                raise KeyError(msg)

        passages = [".".join(passage) for passage in passages]

        if _debug:
            duplicates = set([n for n in passages if passages.count(n) > 1])
            if len(duplicates) > 0:
                message = ", ".join(duplicates)
                warnings.warn(message, DuplicateReference)
            del duplicates
            empties = [n for n in passages if n.rstrip('.') != n or n == '']
            if len(empties) > 0:
                message = '{} empty reference(s) at citation level {}'.format(len(empties), level)
                print(empties)
                warnings.warn(message, EmptyReference)

        references = CtsReferenceSet(
            [CtsReference(reff) for reff in passages],
            citation=self.citation.root[level-1],
            level=level
        )
        return references