code: def build_deprecated_datatypes_py():
      """
      Build datatype (graph_objs) class source code string for deprecated
      datatypes
  
      Returns
      -------
      str
      """
  
      # Initialize source code buffer
      # -----------------------------
      buffer = StringIO()
  
      # Write warnings import
      # ---------------------
      buffer.write("import warnings\n")
  
      # Write warnings filter
      # ---------------------
      # Use filter to enable DeprecationWarnings on our deprecated classes
      buffer.write(
          r"""
  warnings.filterwarnings('default',
                          r'plotly\.graph_objs\.\w+ is deprecated',
                          DeprecationWarning)
  
  
  """
      )
  
      # Write deprecated class definitions
      # ----------------------------------
      for class_name, opts in DEPRECATED_DATATYPES.items():
          base_class_name = opts["base_type"].__name__
          depr_msg = build_deprecation_message(class_name, **opts)
  
          buffer.write(
              f"""\
  class {class_name}({base_class_name}):
      \"\"\"
      {depr_msg}
      \"\"\"
      def __init__(self, *args, **kwargs):
          \"\"\"
          {depr_msg}
          \"\"\"
          warnings.warn(\"\"\"{depr_msg}\"\"\", DeprecationWarning)
          super({class_name}, self).__init__(*args, **kwargs)\n\n\n"""
          )
  
      # Return source string
      # --------------------
      return buffer.getvalue()
  
imports: from io import StringIO
  from os import path
  from codegen.utils import write_source_py
label_desc: Use image node_id 1 for calling a global function with example usage: build_deprecated_datatypes_py() and returns: buffer