How to create node groups and attach header for each node group in plotly sankey?

Hello,
I am working to create sankey diagram showing Term by Term courses mapping.
for ex: Term 1 courses mapping to Term 2 courses, Term 2 courses mapping to Term 3 courses…up to 8 terms.
Here i the screenshot of what i want?

You can find the link here.

I want to display term by term mapping and also title for each node group in plotly. Can someone please help me out?

Thanks in advance.
I am using Pandas and python.