code: def encrypt(self, wif):
          
          if not self.unlocked():
              raise WalletLocked
          return format(bip38.encrypt(str(wif), self.masterkey), "encwif")
docs: Encrypt the content according to BIP38
  
              :param str wif: Unencrypted key