<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _generate_sequences(self, primary_label, secondary_label, ngrams):
 """Generates aligned sequences between each witness labelled `primary_label` and each witness labelled `secondary_label`, based around `ngrams`. :param primary_label: label for one side of the pairs of witnesses to align :type primary_label: `str` :param secondary_label: label for the other side of the pairs of witnesses to align :type secondary_label: `str` :param ngrams: n-grams to base sequences off :type ngrams: `list` of `str` """

        cols = [constants.WORK_FIELDNAME, constants.SIGLUM_FIELDNAME]
        primary_works = self._matches[self._matches[
            constants.LABEL_FIELDNAME] == primary_label][
                cols].drop_duplicates()
        secondary_works = self._matches[self._matches[
            constants.LABEL_FIELDNAME] == secondary_label][
                cols].drop_duplicates()
        for index, (work1, siglum1) in primary_works.iterrows():
            text1 = self._get_text(self._corpus.get_witness(work1, siglum1))
            label1 = '{}_{}'.format(work1, siglum1)
            for index, (work2, siglum2) in secondary_works.iterrows():
                text2 = self._get_text(self._corpus.get_witness(
                    work2, siglum2))
                label2 = '{}_{}'.format(work2, siglum2)
                self._generate_sequences_for_texts(label1, text1, label2,
                                                   text2, ngrams)