code: def sign_statement(self, statement, node_name, key_file, node_id, id_attr):
          
          import xmlsec
          import lxml.etree
  
          xml = xmlsec.parse_xml(statement)
          signed = xmlsec.sign(xml, key_file)
          signed_str = lxml.etree.tostring(signed, xml_declaration=False, encoding="UTF-8")
          if not isinstance(signed_str, six.string_types):
              signed_str = signed_str.decode("utf-8")
          return signed_str
docs: Sign an XML statement.
  
          The parameters actually used in this CryptoBackend
          implementation are :
  
          :param statement: XML as string
          :param node_name: Name of the node to sign
          :param key_file: xmlsec key_spec string(), filename,
              'pkcs11://' URI or PEM data
          :returns: Signed XML as string