<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def parse_notebook_index(ntbkpth):
 """ Parse the top-level notebook index file at `ntbkpth`. Returns a list of subdirectories in order of appearance in the index file, and a dict mapping subdirectory name to a description. """


    # Convert notebook to RST text in string
    rex = RSTExporter()
    rsttxt = rex.from_filename(ntbkpth)[0]
    # Clean up trailing whitespace
    rsttxt = re.sub(r'\n  ', r'', rsttxt, re.M | re.S)
    pthidx = {}
    pthlst = []
    lines = rsttxt.split('\n')
    for l in lines:
        m = re.match(r'^-\s+`([^<]+)\s+<([^>]+).ipynb>`__', l)
        if m:
            # List of subdirectories in order of appearance in index.rst
            pthlst.append(m.group(2))
            # Dict mapping subdirectory name to description
            pthidx[m.group(2)] = m.group(1)
    return pthlst, pthidx