code: def add_line_break(text, nbchar, maxlen=150):
      """
      adding line break in string if necessary
  
      Parameters
      ----------
      text : string
          string to check in order to add line break
      nbchar : int
          number of characters before line break
      maxlen : int
          number of characters before truncation
  
      Returns
      -------
      string
          original text + line break
      """
      if isinstance(text, str):
          length = 0
          tot_length = 0
          input_word = text.split()
          final_sep = []
          for w in input_word[:-1]:
              length = length + len(w)
              tot_length = tot_length + len(w)
              if tot_length <= maxlen:
                  if length >= nbchar:
                      length = 0
                      final_sep.append("<br />")
                  else:
                      final_sep.append(" ")
          if len(final_sep) == len(input_word) - 1:
              last_char = ""
          else:
              last_char = "..."
  
          new_string = (
              "".join(sum(zip(input_word, final_sep + [""]), ())[:-1])
              + last_char
          )
          return new_string
      else:
          return text
  
file_path: shapash/shapash/utils/utils.py
imports: import numpy
  import pandas
  import socket
  import math
  from shapash.explainer.smart_state import SmartState
  from shapash.explainer.multi_decorator import MultiDecorator
label_desc: Use image node_id 5 for calling a global function with example usage: add_line_break(text, nbchar, maxlen) and returns: new_string, text