code: def _report_subject(self, subject, **kwargs):
          
          description_list = []
          # Remove sess from kwargs if provided, else set sess as all available
          sessions = kwargs.pop('session',
                                self.layout.get_sessions(subject=subject,
                                                         **kwargs))
          if not sessions:
              sessions = [None]
          elif not isinstance(sessions, list):
              sessions = [sessions]
  
          for ses in sessions:
              niftis = self.layout.get(subject=subject, extensions='nii.gz',
                                       **kwargs)
  
              if niftis:
                  description_list.append('For session {0}:'.format(ses))
                  description_list += parsing.parse_niftis(self.layout, niftis,
                                                           subject, self.config,
                                                           session=ses)
                  metadata = self.layout.get_metadata(niftis[0].path)
              else:
                  raise Exception('No niftis for subject {0}'.format(subject))
  
          # Assume all data were converted the same way and use the last nifti
          # file's json for conversion information.
          if 'metadata' not in vars():
              raise Exception('No valid jsons found. Cannot generate final '
                              'paragraph.')
  
          description = '\n\t'.join(description_list)
          description = description.replace('\tFor session', '\nFor session')
          description += '\n\n{0}'.format(parsing.final_paragraph(metadata))
          return description
docs: Write a report for a single subject.
  
          Parameters
          ----------
          subject : :obj:`str`
              Subject ID.
  
          Attributes
          ----------
          layout : :obj:`bids.layout.BIDSLayout`
              Layout object for a BIDS dataset.
          config : :obj:`dict`
              Configuration info for methods generation.
  
          Returns
          -------
          description : :obj:`str`
              A publication-ready report of the dataset's data acquisition
              information. Each scan type is given its own paragraph.