code: def _assign_samples(tcga_metadataset):
      import pandas as pd
      import munkres
  
      blacklist = []
      sample_to_task_assignment = {}
      for cancer in get_cancers():
          filename = tcga_metadataset.get_processed_filename(cancer)
          dataframe = pd.read_csv(
              filename, sep="\t", index_col=0, header=0
          )
          dataframe = dataframe.drop(blacklist, errors="ignore")
          permutation = dataframe.index[
              torch.randperm(len(dataframe.index))
          ]
          dataframe = dataframe.reindex(permutation)
          labels = dataframe.notna()
          labels = labels.applymap(
              lambda x: 1.0 if x else munkres.DISALLOWED
          )
          all_disallowed = labels.apply(
              lambda x: True if all(x == munkres.DISALLOWED) else False,
              axis=1,
          )
          labels = labels.drop(labels[all_disallowed].index)
  
          matrix = labels.values
          shape = matrix.shape
          # The +5 allows for some slack in the assignment
          # which is necessary for the used implementation to converge on BRCA
          repeats = np.int(np.ceil(shape[0] / shape[1])) + 5
          expanded_matrix = np.tile(matrix, (1, repeats))
  
          indices = munkres.Munkres().compute(expanded_matrix)
          mapped_indices = [(a, b % shape[1]) for a, b in indices]
  
          for index, mapped_index in mapped_indices:
              sample_to_task_assignment.setdefault(
                  (dataframe.columns[mapped_index], cancer), []
              ).append(dataframe.index[index])
  
          blacklist.extend(dataframe.index.tolist())
  
      return sample_to_task_assignment
  
imports: import os
  import json
  import h5py
  import numpy
  import torch
  import copy
  from ordered_set import OrderedSet
  from torchmeta.utils.data import Task, MetaDataset
  from torchmeta.datasets.utils import get_asset
label_desc: Use image node_id 1 for calling a global function with example usage: _assign_samples(tcga_metadataset) and returns: sample_to_task_assignment