code: def get_exp_of_biosample(biosample_rec):
      
      chip_exp_id = biosample_rec.chipseq_experiment_id
      ssc_id = biosample_rec.sorting_biosample_single_cell_sorting_id
      if chip_exp_id:
          return {"type": "chipseq_experiment", "record": models.ChipseqExperiment(chip_exp_id)}
      elif ssc_id:
          return {"type": "single_cell_sorting", "record": models.SingleCellSorting(ssc_id)}
      raise Exception("Biosample {} is not on an experiment.".format(biosample_rec["id"]))
docs: Determines whether the biosample is part of a ChipseqExperiment or SingleCellSorting
      Experiment, and if so, returns the associated experiment as a models.Model instance that
      is one of those two classes. The biosample is determined to be part of a ChipseqExperiment if the Biosample.chipseq_experiment_id
      attribute is set, meaning that the biosample can be associated to the ChipseqExperiment
      as a replicate via any of of the following ChipseqExperiment attributes:
  
          ChipseqExperiment.replicates
          ChipseqExperiment.control_replicates
  
      The biosample will be determined to be part of a SingleCellSorting experiment if the
      Biosample.sorting_biosample_single_cell_sorting attribute is set, meaning that it is the
      SingleCellSorting.sorting_biosample.
  
      Args:
          biosample_rec: `dict`. A Biosample record as returned by instantiating `models.Biosample`.
  
      Raises:
          `Exception`: An experiment is not associated to this biosample.