code: def checktype_seq(self, seq, kind, *, unique=False, **kargs):
          
          exp = self.str_kind(kind)
          
          # Make sure we have a sequence.
          try:
              iterator = iter(seq)
              # Generators aren't sequences. This avoids a confusing bug
              # where we consume a generator by type-checking it, and leave
              # only an exhausted iterator for the user code.
              len(seq)
          except TypeError:
              got = self.str_valtype(seq)
              raise TypeError('Expected sequence of {}; '
                              'got {} instead of sequence'.format(exp, got))
          
          if isinstance(seq, str):
              raise TypeError('Expected sequence of {}; got single str '
                              '(strings do not count as character '
                              'sequences)'.format(exp))
          
          for i, item in enumerate(iterator):
              # Depend on checktype() to check individual elements,
              # but generate an error message that includes the position
              # of the failure.
              try:
                  self.checktype(item, kind, **kargs)
              except TypeError:
                  got = self.str_valtype(item)
                  raise TypeError('Expected sequence of {}; '
                                  'got sequence with {} at position {}'.format(
                                  exp, got, i)) from None
          
          if unique:
              seen = []
              for i, item in enumerate(seq):
                  if item in seen:
                      raise TypeError('Duplicate element {} at '
                                      'position {}'.format(repr(item), i))
                  seen.append(item)
docs: Raise TypeError if seq is not a sequence of elements satisfying
          kind. Optionally require elements to be unique.
          
          As a special case, a string is considered to be an atomic value
          rather than a sequence of single-character strings. (Thus,
          checktype_seq('foo', str) will fail.)