code: def decrypt_element(encrypted_data, key, debug=False, inplace=False):
          
          if isinstance(encrypted_data, Element):
              encrypted_data = fromstring(str(encrypted_data.toxml()), forbid_dtd=True)
          elif isinstance(encrypted_data, basestring):
              encrypted_data = fromstring(str(encrypted_data), forbid_dtd=True)
          elif not inplace and isinstance(encrypted_data, etree._Element):
              encrypted_data = deepcopy(encrypted_data)
  
          error_callback_method = None
          if debug:
              error_callback_method = print_xmlsec_errors
          xmlsec.set_error_callback(error_callback_method)
  
          mngr = xmlsec.KeysMngr()
  
          key = xmlsec.Key.loadMemory(key, xmlsec.KeyDataFormatPem, None)
          mngr.addKey(key)
          enc_ctx = xmlsec.EncCtx(mngr)
  
          return enc_ctx.decrypt(encrypted_data)
docs: Decrypts an encrypted element.
  
          :param encrypted_data: The encrypted data.
          :type: lxml.etree.Element | DOMElement | basestring
  
          :param key: The key.
          :type: string
  
          :param debug: Activate the xmlsec debug
          :type: bool
  
          :param inplace: update passed data with decrypted result
          :type: bool
  
          :returns: The decrypted element.
          :rtype: lxml.etree.Element