code: def to_xdr_object(self):
          
          trustor = account_xdr_object(self.trustor)
          length = len(self.asset_code)
          assert length <= 12
          pad_length = 4 - length if length <= 4 else 12 - length
          # asset_code = self.asset_code + '\x00' * pad_length
          # asset_code = bytearray(asset_code, encoding='utf-8')
          asset_code = bytearray(self.asset_code, 'ascii') + b'\x00' * pad_length
          asset = Xdr.nullclass()
          if len(asset_code) == 4:
              asset.type = Xdr.const.ASSET_TYPE_CREDIT_ALPHANUM4
              asset.assetCode4 = asset_code
          else:
              asset.type = Xdr.const.ASSET_TYPE_CREDIT_ALPHANUM12
              asset.assetCode12 = asset_code
  
          allow_trust_op = Xdr.types.AllowTrustOp(trustor, asset, self.authorize)
          self.body.type = Xdr.const.ALLOW_TRUST
          self.body.allowTrustOp = allow_trust_op
          return super(AllowTrust, self).to_xdr_object()
docs: Creates an XDR Operation object that represents this
          :class:`AllowTrust`.