code: def ensure_security_header(envelope, queue):
      
      (header,) = HEADER_XPATH(envelope)
      security = SECURITY_XPATH(header)
      if security:
          for timestamp in TIMESTAMP_XPATH(security[0]):
              queue.push_and_mark(timestamp)
          return security[0]
      else:
          nsmap = {
              'wsu': ns.wsuns[1],
              'wsse': ns.wssens[1],
          }
          return _create_element(header, 'wsse:Security', nsmap)
docs: Insert a security XML node if it doesn't exist otherwise update it.