(self)
Returns a :class:`Ref` to the next populated segment.

        If this ref is not segment level, will return ``self```

        :return: :class:`Ref`
Returns a :class:`Ref` to the next populated segment.
Returns a : class : Ref to the next populated segment .
def next_segment_ref(self):
        """
        Returns a :class:`Ref` to the next populated segment.

        If this ref is not segment level, will return ``self```

        :return: :class:`Ref`
        """
        r = self.ending_ref()
        if not r.is_segment_level():
            return r
        sectionRef = r.section_ref()
        sectionLength = self.get_state_ja().sub_array_length([i - 1 for i in sectionRef.sections])
        if r.sections[-1] < sectionLength:
            d = r._core_dict()
            d["sections"] = d["toSections"] = r.sections[:-1] + [r.sections[-1] + 1]
            return Ref(_obj=d)
        else:
            try:
                return r.next_section_ref().subref(1)
            except AttributeError:
                # No next section
                return None
def next_segment_ref ( self ) : r = self . ending_ref ( ) if not r . is_segment_level ( ) : return r sectionRef = r . section_ref ( ) sectionLength = self . get_state_ja ( ) . sub_array_length ( [ i - 1 for i in sectionRef . sections ] ) if r . sections [ - 1 ] < sectionLength : d = r . _core_dict ( ) d [ "sections" ] = d [ "toSections" ] = r . sections [ : - 1 ] + [ r . sections [ - 1 ] + 1 ] return Ref ( _obj = d ) else : try : return r . next_section_ref ( ) . subref ( 1 ) except AttributeError : # No next section return None