I don't know why you have the [] at the end of all these lines. I don't think they are doing anything other than making the code less readable.
============
ok, following on from our discussion that it's because None is returned if there isn't a child. The way to handle that is by providing a default value:
for chapter in course_block_tree.get('children', []):
Here: https://github.com/arpitgandhi-xoriant/lti_params_api/blob/331f1c5b30d92ca1dacca353ed54f5fb3de32248/utils.py#L25
you are getting the display_name from the component but we actually want the display_name from the vertical.
Here: https://github.com/arpitgandhi-xoriant/lti_params_api/blob/331f1c5b30d92ca1dacca353ed54f5fb3de32248/utils.py#L8
I don't know why you have the [] at the end of all these lines. I don't think they are doing anything other than making the code less readable.
============ ok, following on from our discussion that it's because None is returned if there isn't a child. The way to handle that is by providing a default value: for chapter in course_block_tree.get('children', []):