nodes: 0, module; 1, function_definition; 2, function_name:create_back_links; 3, parameters; 4, block; 5, identifier:env; 6, expression_statement; 7, if_statement; 8, expression_statement; 9, for_statement; 10, expression_statement; 11, comment:"""
      Create back-links in all found needs.
      But do this only once, as all needs are already collected and this sorting is for all
      needs and not only for the ones of the current document.
  
      :param env: sphinx enviroment
      :return: None
      """; 12, subscript; 13, block; 14, assignment; 15, pattern_list; 16, call; 17, block; 18, assignment; 19, attribute; 20, string; 21, return_statement; 22, identifier:needs; 23, attribute; 24, identifier:key; 25, identifier:need; 26, attribute; 27, argument_list; 28, for_statement; 29, subscript; 30, True; 31, identifier:env; 32, identifier:needs_workflow; 33, string_content:backlink_creation; 34, identifier:env; 35, identifier:needs_all_needs; 36, identifier:needs; 37, identifier:items; 38, identifier:link; 39, subscript; 40, block; 41, attribute; 42, string; 43, identifier:need; 44, string:"links"; 45, expression_statement; 46, try_statement; 47, if_statement; 48, identifier:env; 49, identifier:needs_workflow; 50, string_content:backlink_creation; 51, assignment; 52, block; 53, except_clause; 54, comparison_operator:link_main in needs; 55, block; 56, identifier:link_main; 57, subscript; 58, expression_statement; 59, identifier:IndexError; 60, block; 61, identifier:link_main; 62, identifier:needs; 63, if_statement; 64, comment:# Handling of links to need_parts inside a need; 65, if_statement; 66, call; 67, integer:0; 68, assignment; 69, expression_statement; 70, comparison_operator:key not in needs[link_main]["links_back"]; 71, block; 72, comparison_operator:link_part is not None; 73, block; 74, attribute; 75, argument_list; 76, identifier:link_part; 77, subscript; 78, assignment; 79, identifier:key; 80, subscript; 81, expression_statement; 82, identifier:link_part; 83, None; 84, if_statement; 85, identifier:link; 86, identifier:split; 87, string; 88, call; 89, integer:1; 90, identifier:link_part; 91, None; 92, subscript; 93, string:"links_back"; 94, call; 95, comparison_operator:link_part in needs[link_main]['parts']; 96, block; 97, string_content:.; 98, attribute; 99, argument_list; 100, identifier:needs; 101, identifier:link_main; 102, attribute; 103, argument_list; 104, identifier:link_part; 105, subscript; 106, if_statement; 107, expression_statement; 108, identifier:link; 109, identifier:split; 110, string; 111, subscript; 112, identifier:append; 113, identifier:key; 114, subscript; 115, string; 116, comparison_operator:'links_back' not in needs[link_main]['parts'][link_part].keys(); 117, block; 118, call; 119, string_content:.; 120, subscript; 121, string:"links_back"; 122, identifier:needs; 123, identifier:link_main; 124, string_content:parts; 125, string; 126, call; 127, expression_statement; 128, attribute; 129, argument_list; 130, identifier:needs; 131, identifier:link_main; 132, string_content:links_back; 133, attribute; 134, argument_list; 135, assignment; 136, subscript; 137, identifier:append; 138, identifier:key; 139, subscript; 140, identifier:keys; 141, subscript; 142, list; 143, subscript; 144, string; 145, subscript; 146, identifier:link_part; 147, subscript; 148, string; 149, subscript; 150, identifier:link_part; 151, string_content:links_back; 152, subscript; 153, string; 154, subscript; 155, identifier:link_part; 156, string_content:links_back; 157, subscript; 158, string; 159, identifier:needs; 160, identifier:link_main; 161, string_content:parts; 162, subscript; 163, string; 164, identifier:needs; 165, identifier:link_main; 166, string_content:parts; 167, identifier:needs; 168, identifier:link_main; 169, string_content:parts
code: def create_back_links(env):
      """
      Create back-links in all found needs.
      But do this only once, as all needs are already collected and this sorting is for all
      needs and not only for the ones of the current document.
  
      :param env: sphinx enviroment
      :return: None
      """
      if env.needs_workflow['backlink_creation']:
          return
  
      needs = env.needs_all_needs
      for key, need in needs.items():
          for link in need["links"]:
              link_main = link.split('.')[0]
              try:
                  link_part = link.split('.')[1]
              except IndexError:
                  link_part = None
  
              if link_main in needs:
                  if key not in needs[link_main]["links_back"]:
                      needs[link_main]["links_back"].append(key)
  
                  # Handling of links to need_parts inside a need
                  if link_part is not None:
                      if link_part in needs[link_main]['parts']:
                          if 'links_back' not in needs[link_main]['parts'][link_part].keys():
                              needs[link_main]['parts'][link_part]['links_back'] = []
                          needs[link_main]['parts'][link_part]['links_back'].append(key)
  
      env.needs_workflow['backlink_creation'] = True