code: def sort_by_type(file_list):
      ret_dict = defaultdict(list)
      for filepath in file_list:
          _, ext = os.path.splitext(filepath)
          ret_dict[ext.replace('.', '')].append(filepath)
      return ret_dict