Write this :class:`SampleSheet` to a file-like object.

        Args:
            handle: Object to wrap by csv.writer.
            blank_lines: Number of blank lines to write between sections.

def write(self, handle: TextIO, blank_lines: int = 1) -> None:
        """Write this :class:`SampleSheet` to a file-like object.

        Args:
            handle: Object to wrap by csv.writer.
            blank_lines: Number of blank lines to write between sections.

        """
        if not isinstance(blank_lines, int) or blank_lines <= 0:
            raise ValueError('Number of blank lines must be a positive int.')

        writer = csv.writer(handle)
        csv_width: int = max([len(self.all_sample_keys), 2])

        section_order = ['Header', 'Reads'] + self._sections + ['Settings']

        def pad_iterable(
            iterable: Iterable, size: int = csv_width, padding: str = ''
        ) -> List[str]:
            return list(islice(chain(iterable, repeat(padding)), size))

        def write_blank_lines(
            writer: Any, n: int = blank_lines, width: int = csv_width
        ) -> None:
            for i in range(n):
                writer.writerow(pad_iterable([], width))

        for title in section_order:
            writer.writerow(pad_iterable([f'[{title}]'], csv_width))
            section = getattr(self, title)
            if title == 'Reads':
                for read in self.Reads:
                    writer.writerow(pad_iterable([read], csv_width))
            else:
                for key, value in section.items():
                    writer.writerow(pad_iterable([key, value], csv_width))
            write_blank_lines(writer)

        writer.writerow(pad_iterable(['[Data]'], csv_width))
        writer.writerow(pad_iterable(self.all_sample_keys, csv_width))

        for sample in self.samples:
            line = [getattr(sample, key) for key in self.all_sample_keys]
            writer.writerow(pad_iterable(line, csv_width))