code: def encrypt(self, data, pad=True):
          
          encrypted_data = b""
          for i in range(0, len(data), 8):
              block = data[i:i + 8]
              block_length = len(block)
              if block_length != 8 and pad:
                  block += b"\x00" * (8 - block_length)
              elif block_length != 8:
                  raise ValueError("DES encryption must be a multiple of 8 "
                                   "bytes")
              encrypted_data += self._encode_block(block)
  
          return encrypted_data
docs: DES encrypts the data based on the key it was initialised with.
  
          :param data: The bytes string to encrypt
          :param pad: Whether to right pad data with \x00 to a multiple of 8
          :return: The encrypted bytes string