def _check_compact_char_occurrence(encoded, zero_char, chunk_size=5):
    """Ensures "z" characters do not occur in the middle of 5-tuple chunks
  when decoding. It will raise a ``ValueError`` if such an occurrence is
  found.

  :param encoded:
      The encoded sequence. (ASCII encoded string).
  :param zero_char:
      The "z" character (default "z").
  :param chunk_size:
      5 (default).
  """
    counter = 0
    for i, char in enumerate(encoded):
        if char == zero_char[0]:
            if counter % chunk_size:
                raise ValueError(
                    'zero char `%r` occurs in the middle of a chunk at index %d'
                     % (zero_char, i))
            else:
                counter = 0
        else:
            counter += 1
