def _encode_func(self, bits): remainder = len(bits) % 8 pad_len = (8 - remainder) % 8 return bits + Bits(pad_len)