(tm_, stix_doc, cert)
return content_block
Build a content block from the STIX document. Encrypt it if a
    certificate is provided.

    :param tm_: The TAXII version that we should use.
    :type tm_: TAXII message class.
    :param stix_doc: The STIX document.
    :type stix_doc: class 'stix.core.stix_package.STIXPackage'
    :param cert: Path to the certificate used to encrypt the content block.
    :type cert: str
    :returns: A content block class
Build a content block from the STIX document. Encrypt it if a
    certificate is provided.
Build a content block from the STIX document . Encrypt it if a certificate is provided .
def build_content_block(tm_, stix_doc, cert):
    """
    Build a content block from the STIX document. Encrypt it if a
    certificate is provided.

    :param tm_: The TAXII version that we should use.
    :type tm_: TAXII message class.
    :param stix_doc: The STIX document.
    :type stix_doc: class 'stix.core.stix_package.STIXPackage'
    :param cert: Path to the certificate used to encrypt the content block.
    :type cert: str
    :returns: A content block class
    """
    content_block = tm_.ContentBlock(content_binding = t.CB_STIX_XML_111,
                                     content = stix_doc.to_xml())

    if cert: # if encryption cert provided, encrypt the content_block
        encrypted_block = encrypt_block(content_block.to_xml(), cert)

        # Wrap encrypted block in content block
        content_block = tm_.ContentBlock(
                             content_binding = "application/x-pkcs7-mime",
                             content = encrypted_block)
    return content_block
def build_content_block ( tm_ , stix_doc , cert ) : content_block = tm_ . ContentBlock ( content_binding = t . CB_STIX_XML_111 , content = stix_doc . to_xml ( ) ) if cert : # if encryption cert provided, encrypt the content_block encrypted_block = encrypt_block ( content_block . to_xml ( ) , cert ) # Wrap encrypted block in content block content_block = tm_ . ContentBlock ( content_binding = "application/x-pkcs7-mime" , content = encrypted_block ) return content_block