class_docstr: Handles sending notifications via the configured notifiers
      
docstr: Creates a message from a user defined template
  
  Args:
      new_analysis (dict): A dictionary of data related to the analysis to send a message about.
      template (str): A Jinja formatted message template.
  
  Returns:
      str: The templated messages for the notifier.
docstr_tok: ["Creates","a","message","from","a","user","defined","template","Args",":","new_analysis","(","dict",")",":","A","dictionary","of","data","related","to","the","analysis","to","send","a","message","about",".","template","(","str",")",":","A","Jinja","formatted","message","template",".","Returns",":","str",":","The","templated","messages","for","the","notifier","."]
code: def _indicator_message_templater(self, new_analysis, template):
      """Creates a message from a user defined template
  
      Args:
          new_analysis (dict): A dictionary of data related to the analysis to send a message about.
          template (str): A Jinja formatted message template.
  
      Returns:
          str: The templated messages for the notifier.
      """
  
      if not self.last_analysis:
          self.last_analysis = new_analysis
  
      message_template = Template(template)
      new_message = str()
      for exchange in new_analysis:
          for market in new_analysis[exchange]:
              for indicator_type in new_analysis[exchange][market]:
                  if indicator_type == "informants":
                      continue
                  for indicator in new_analysis[exchange][market][
                      indicator_type
                  ]:
                      for index, analysis in enumerate(
                          new_analysis[exchange][market][
                              indicator_type
                          ][indicator]
                      ):
                          if analysis["result"].shape[0] == 0:
                              continue
  
                          values = dict()
  
                          if indicator_type == "indicators":
                              for signal in analysis["config"][
                                  "signal"
                              ]:
                                  latest_result = analysis[
                                      "result"
                                  ].iloc[-1]
  
                                  values[signal] = analysis[
                                      "result"
                                  ].iloc[-1][signal]
                                  if isinstance(values[signal], float):
                                      values[signal] = format(
                                          values[signal], ".8f"
                                      )
                          elif indicator_type == "crossovers":
                              latest_result = analysis["result"].iloc[
                                  -1
                              ]
  
                              key_signal = "{}_{}".format(
                                  analysis["config"]["key_signal"],
                                  analysis["config"][
                                      "key_indicator_index"
                                  ],
                              )
  
                              crossed_signal = "{}_{}".format(
                                  analysis["config"]["crossed_signal"],
                                  analysis["config"][
                                      "crossed_indicator_index"
                                  ],
                              )
  
                              values[key_signal] = analysis[
                                  "result"
                              ].iloc[-1][key_signal]
                              if isinstance(values[key_signal], float):
                                  values[key_signal] = format(
                                      values[key_signal], ".8f"
                                  )
  
                              values[crossed_signal] = analysis[
                                  "result"
                              ].iloc[-1][crossed_signal]
                              if isinstance(
                                  values[crossed_signal], float
                              ):
                                  values[crossed_signal] = format(
                                      values[crossed_signal], ".8f"
                                  )
  
                          status = "neutral"
                          if latest_result["is_hot"]:
                              status = "hot"
                          elif latest_result["is_cold"]:
                              status = "cold"
  
                          # Save status of indicator's new analysis
                          new_analysis[exchange][market][
                              indicator_type
                          ][indicator][index]["status"] = status
  
                          if (
                              latest_result["is_hot"]
                              or latest_result["is_cold"]
                          ):
                              try:
                                  last_status = self.last_analysis[
                                      exchange
                                  ][market][indicator_type][indicator][
                                      index
                                  ][
                                      "status"
                                  ]
                              except:
                                  last_status = str()
  
                              should_alert = True
                              if (
                                  analysis["config"]["alert_frequency"]
                                  == "once"
                              ):
                                  if last_status == status:
                                      should_alert = False
  
                              if not analysis["config"][
                                  "alert_enabled"
                              ]:
                                  should_alert = False
  
                              if should_alert:
                                  (
                                      base_currency,
                                      quote_currency,
                                  ) = market.split("/")
                                  new_message += (
                                      message_template.render(
                                          values=values,
                                          exchange=exchange,
                                          market=market,
                                          base_currency=base_currency,
                                          quote_currency=quote_currency,
                                          indicator=indicator,
                                          indicator_number=index,
                                          analysis=analysis,
                                          status=status,
                                          last_status=last_status,
                                      )
                                  )
  
      # Merge changes from new analysis into last analysis
      self.last_analysis = {**self.last_analysis, **new_analysis}
      return new_message
  
imports: import json
  import structlog
  from jinja2 import Template
  from notifiers.twilio_client import TwilioNotifier
  from notifiers.slack_client import SlackNotifier
  from notifiers.discord_client import DiscordNotifier
  from notifiers.gmail_client import GmailNotifier
  from notifiers.telegram_client import TelegramNotifier
  from notifiers.webhook_client import WebhookNotifier
  from notifiers.stdout_client import StdoutNotifier
label_desc: Use image node_id 11 for calling the Notifier obj's underlying member method code with example usage: obj._indicator_message_templater(new_analysis, template) and returns: new_message