code: def _write_sample_config(run_folder, ldetails):
      
      out_file = os.path.join(run_folder, "%s.yaml" % os.path.basename(run_folder))
      with open(out_file, "w") as out_handle:
          fc_name, fc_date = flowcell.parse_dirname(run_folder)
          out = {"details": sorted([_prepare_sample(x, run_folder) for x in ldetails],
                                   key=operator.itemgetter("name", "description")),
                 "fc_name": fc_name,
                 "fc_date": fc_date}
          yaml.safe_dump(out, out_handle, default_flow_style=False, allow_unicode=False)
      return out_file
docs: Generate a bcbio-nextgen YAML configuration file for processing a sample.