code: def write_datatype_py(outdir, node):
      """
      Build datatype (graph_objs) class source code and write to a file
  
      Parameters
      ----------
      outdir :
          Root outdir in which the graph_objs package should reside
      node :
          The datatype node (node.is_datatype must evaluate to true) for which
          to build the datatype class
  
      Returns
      -------
      None
      """
  
      # Build file path
      # ---------------
      # filepath = opath.join(outdir, "graph_objs", *node.parent_path_parts, "__init__.py")
      filepath = opath.join(
          outdir,
          "graph_objs",
          *node.parent_path_parts,
          "_" + node.name_undercase + ".py",
      )
  
      # Generate source code
      # --------------------
      datatype_source = build_datatype_py(node)
  
      # Write file
      # ----------
      write_source_py(datatype_source, filepath, leading_newlines=2)
  
file_path: plotly.py/packages/python/plotly/codegen/datatypes.py
imports: import os.path
  import textwrap
  from io import StringIO
  from codegen.utils import PlotlyNode, write_source_py
label_desc: Use image node_id 6 for calling a global function with example usage: write_datatype_py(outdir, node) without return types