code: def remove_duplicated_names(name_list):
      """
      From a list of list of names remove the items that are duplicated
      :param name_list: list of list of names to investigate
      :return duplicates_removed: list of list of names freed of duplicates
      """
      flattened_list = [
          item for sublist in name_list for item in sublist
      ]
      list_duplicated = [
          item
          for item in flattened_list
          if flattened_list.count(item) > 1
      ]
      duplicates_removed = []
      for names in name_list:
          duplicates_removed.append(
              [name for name in names if name not in list_duplicated]
          )
      return duplicates_removed
  
file_path: NiftyNet/niftynet/utilities/util_csv.py
imports: from __future__ import absolute_import, print_function, division
  import csv
  import os
  import sys
  from difflib import SequenceMatcher
  import numpy
  from niftynet.io.misc_io import touch_folder
  from niftynet.utilities.filename_matching import KeywordsMatching
label_desc: Use image node_id 5 for calling a global function with example usage: remove_duplicated_names(name_list) and returns: duplicates_removed