code: def split_subchapters(self, jsondata=None):
          
          self.check_path()
  
          toc = jsondata or self.get_toc(subchapters=True)
          chapters = []
  
          for index, chpagerange in enumerate(toc):
              # chapter prefix of the form 1-, 2-, 3-,... to avoid name conflicsts
              chprefix = str(index) + '-'
              # Case A: chapter with no subchapters
              if 'children' not in chpagerange or not chpagerange['children']:
                  write_to_path = self.write_pagerange(chpagerange, prefix=chprefix)
                  chapters.append({"title": chpagerange['title'], "path": write_to_path})
  
              # Case B: chapter with subchapters
              elif 'children' in chpagerange:
                  chapter_topic = { 'title': chpagerange['title'], 'children': [] }
                  subchpageranges = chpagerange['children']
                  first_subchapter = subchpageranges[0]
  
                  # Handle case when chapter has "intro pages" before first subchapter
                  if first_subchapter['page_start'] > chpagerange['page_start']:
                      chintro_pagerange = {
                          'title': chpagerange['title'],
                          'page_start': chpagerange['page_start'],
                          'page_end': first_subchapter['page_start']
                      }
                      write_to_path = self.write_pagerange(chintro_pagerange, prefix=chprefix)
                      chapter_topic['children'].append({"title": chpagerange['title'], "path": write_to_path})
  
                  # Handle all subchapters
                  subchapter_nodes = self.split_chapters(jsondata=subchpageranges, prefix=chprefix)
                  chapter_topic['children'].extend(subchapter_nodes)
                  chapters.append(chapter_topic)
  
          return chapters
docs: Transform a PDF doc into tree of chapters (topics) and subchapters (docs)
          based on the page-range information obtained from the PDF table of contents
          or manually passed in through `jsondata`.
          Individual split PDFs are stored in the output folder `self.directory`.