docs: def calculate_signature(self, node, sign=True):
          """
          Calculate or verifies the signature
          :param node: Signature node
          :type node: lxml.etree.Element
          :param sign: It checks if it must calculate or verify
          :type sign: bool
          :return: None
          """
          signed_info_xml = node.find('ds:SignedInfo',
                                      namespaces=constants.NS_MAP)
          canonicalization_method = signed_info_xml.find(
              'ds:CanonicalizationMethod', namespaces=constants.NS_MAP
          ).get('Algorithm')
          signature_method = signed_info_xml.find(
              'ds:SignatureMethod', namespaces=constants.NS_MAP
          ).get('Algorithm')
          if signature_method not in constants.TransformUsageSignatureMethod:
              raise Exception('Method ' + signature_method + ' not accepted')
          signature = constants.TransformUsageSignatureMethod[signature_method]
          signed_info = self.canonicalization(
              canonicalization_method, signed_info_xml
          )
          if not sign:
              signature_value = node.find('ds:SignatureValue',
                                          namespaces=constants.NS_MAP).text
              public_key = signature['method'].get_public_key(node, self)
              signature['method'].verify(
                  signature_value,
                  signed_info,
                  public_key,
                  signature['digest']
              )
          else:
              node.find(
                  'ds:SignatureValue', namespaces=constants.NS_MAP
              ).text = b64_print(base64.b64encode(
                  signature['method'].sign(
                      signed_info,
                      self.private_key,
                      signature['digest']
                  )
              ))