docs: def send_segment_document_to_xray_daemon(segment_document):
      """Format and send document to the X-Ray Daemon."""
      try:
          xray_daemon = get_xray_daemon()
      except XRayDaemonNotFoundError:
          LOGGER.error('X-Ray Daemon not running, skipping send')
          return
  
      message = u'{header}\n{document}'.format(
          header=json.dumps(XRAY_DAEMON_HEADER),
          document=json.dumps(
              segment_document,
              ensure_ascii=False,
              cls=StringJSONEncoder,
          ),
      )
  
      send_data_on_udp(
          ip_address=xray_daemon.ip_address,
          port=xray_daemon.port,
          data=message,
      )