code: def scored_to_phenotype(self,phenotypes):
          def _apply_score(scored_calls,phenotypes):
              present = sorted(list(set(phenotypes)&set(scored_calls.keys())))
              total = sum([scored_calls[x] for x in present])
              if total > 1: 
                  raise ValueError("You cant extract phenotypes from scores if they are not mutually exclusive")
              if total == 0: return np.nan
              for label in present:
                  if scored_calls[label] == 1: return label
              raise ValueError("Should have hit an exit criteria already")
          output = self.copy()
          output['phenotype_label'] = output.apply(lambda x: _apply_score(x['scored_calls'],phenotypes),1)
          output['phenotype_calls'] = output.apply(lambda x: 
              dict([(y,1 if x['phenotype_label']==y else 0) for y in phenotypes])
          ,1)
          return output