def encrypt_ctr(self, data, counter):
    """
    Return an iterator that encrypts `data` using the Counter (CTR) mode of
    operation.
    
    CTR mode can operate on `data` of any length.
    
    Each iteration, except the last, always returns a block-sized :obj:`bytes`
    object (i.e. 8 bytes). The last iteration may return a :obj:`bytes` object
    with a length less than the block-size, if `data` is not a multiple of the
    block-size in length.
        
    `counter` should be an iterable sequence of 64-bit integers which are
    guaranteed not to repeat for a long time.
    If any integer in the sequence is not less than 2^64, a :exc:`ValueError`
    exception is raised.
    ``len(counter)`` should be at least as much as ``ceil(len(data)/8)``,
    otherwise the returned iterator will only encrypt `data` partially,
    stopping when `counter` is exhausted.
    A good default is implemented by :func:`blowfish.ctr_counter`.
    
    `data` should be a :obj:`bytes`-like object (of any length).
    """
    S1, S2, S3, S4 = self.S
    P = self.P
    
    u4_1_pack = self._u4_1_pack
    u1_4_unpack = self._u1_4_unpack
    encrypt = self._encrypt
    
    u4_2_pack = self._u4_2_pack
    
    u4_2_unpack = self._u4_2_unpack
    u8_1_pack = self._u8_1_pack
    
    data_len = len(data)
    extra_bytes = data_len % 8
    last_block_stop_i = data_len - extra_bytes
    
    for (plain_L, plain_R), counter_n in zip(
      self._u4_2_iter_unpack(data[0:last_block_stop_i]),
      counter
    ):
      try:
        counter_L, counter_R = u4_2_unpack(u8_1_pack(counter_n))
      except struct_error:
        raise ValueError("integer in counter is not less than 2^64")
      
      counter_L, counter_R = encrypt(
        counter_L, counter_R,
        P, S1, S2, S3, S4,
        u4_1_pack, u1_4_unpack
      )
      yield u4_2_pack(plain_L ^ counter_L, plain_R ^ counter_R)
      
    if extra_bytes:
      try:
        counter_L, counter_R = u4_2_unpack(u8_1_pack(next(counter)))
      except struct_error:
        raise ValueError("integer in counter is not less than 2^64")
      
      counter_L, counter_R = encrypt(
        counter_L, counter_R,
        P, S1, S2, S3, S4,
        u4_1_pack, u1_4_unpack
      )
      yield bytes(
        b ^ n for b, n in zip(
          data[last_block_stop_i:],
          u4_2_pack(counter_L, counter_R)
        )
      )
Return an iterator that encrypts `data` using the Counter (CTR) mode of
    operation.
    
    CTR mode can operate on `data` of any length.
    
    Each iteration, except the last, always returns a block-sized :obj:`bytes`
    object (i.e. 8 bytes). The last iteration may return a :obj:`bytes` object
    with a length less than the block-size, if `data` is not a multiple of the
    block-size in length.
        
    `counter` should be an iterable sequence of 64-bit integers which are
    guaranteed not to repeat for a long time.
    If any integer in the sequence is not less than 2^64, a :exc:`ValueError`
    exception is raised.
    ``len(counter)`` should be at least as much as ``ceil(len(data)/8)``,
    otherwise the returned iterator will only encrypt `data` partially,
    stopping when `counter` is exhausted.
    A good default is implemented by :func:`blowfish.ctr_counter`.
    
    `data` should be a :obj:`bytes`-like object (of any length).