code: def build_deprecation_message(class_name, base_type, new):
      """
      Build deprecation warning message for a deprecated class
  
      Parameters
      ----------
      class_name : str
          Name of a deprecated class
      base_type: type
          base class (either list or dict)
      new: list of str
          List of replacements that users should use instead.
          Replacements may be:
              - A package string relative to plotly.graph_objs. In this case the
                replacement class is assumed to be named `class_name`.
                e.g. `new` == ['layout`] and `class_name` == 'XAxis` corresponds
                to the 'plotly.graph_objs.layout.XAxis' class
              - String containing the package and class. The string is
                identified as containing a class name if the final name in the
                package string begins with an uppercase letter.
                e.g. `new` == ['Scatter'] corresponds to the
                ['plotly.graph_objs.Scatter'] class.
              - The literal string 'etc.'. This string is not interpreted as a
                package or class and is displayed to the user as-is to
                indicate that the list of replacement classes is not complete.
  
      Returns
      -------
      str
      """
      replacements = []
      for repl in new:
          if repl == "etc.":
              replacements.append(repl)
          else:
              repl_parts = repl.split(".")
  
              # Add class_name if class not provided
              repl_is_class = repl_parts[-1][0].isupper()
              if not repl_is_class:
                  repl_parts.append(class_name)
  
              # Add plotly.graph_objs prefix
              full_class_str = ".".join(
                  ["plotly", "graph_objs"] + repl_parts
              )
              replacements.append(full_class_str)
  
      replacemens_str = "\n  - ".join(replacements)
  
      if base_type == list:
          return f"""\
  plotly.graph_objs.{class_name} is deprecated.
  Please replace it with a list or tuple of instances of the following types
    - {replacemens_str}
  """
      else:
          return f"""\
  plotly.graph_objs.{class_name} is deprecated.
  Please replace it with one of the following more specific types
    - {replacemens_str}
  """
  
imports: from io import StringIO
  from os import path
  from codegen.utils import write_source_py
label_desc: Use image node_id 2 for calling a global function with example usage: build_deprecation_message(class_name, base_type, new) and returns: str, class_name, str, replacemens_str, str, str, class_name, str, replacemens_str, str