code: def apply_default_cascade(args):
      # first we apply px.defaults to unspecified args
  
      for param in defaults.__slots__:
          if param in args and args[param] is None:
              args[param] = getattr(defaults, param)
  
      # load the default template if set, otherwise "plotly"
      if args["template"] is None:
          if pio.templates.default is not None:
              args["template"] = pio.templates.default
          else:
              args["template"] = "plotly"
  
      try:
          # retrieve the actual template if we were given a name
          args["template"] = pio.templates[args["template"]]
      except Exception:
          # otherwise try to build a real template
          args["template"] = go.layout.Template(args["template"])
  
      # if colors not set explicitly or in px.defaults, defer to a template
      # if the template doesn't have one, we set some final fallback defaults
      if "color_continuous_scale" in args:
          if (
              args["color_continuous_scale"] is None
              and args["template"].layout.colorscale.sequential
          ):
              args["color_continuous_scale"] = [
                  x[1]
                  for x in args["template"].layout.colorscale.sequential
              ]
          if args["color_continuous_scale"] is None:
              args["color_continuous_scale"] = sequential.Viridis
  
      if "color_discrete_sequence" in args:
          if (
              args["color_discrete_sequence"] is None
              and args["template"].layout.colorway
          ):
              args["color_discrete_sequence"] = args[
                  "template"
              ].layout.colorway
          if args["color_discrete_sequence"] is None:
              args["color_discrete_sequence"] = qualitative.D3
  
      # if symbol_sequence/line_dash_sequence not set explicitly or in px.defaults,
      # see if we can defer to template. If not, set reasonable defaults
      if "symbol_sequence" in args:
          if (
              args["symbol_sequence"] is None
              and args["template"].data.scatter
          ):
              args["symbol_sequence"] = [
                  scatter.marker.symbol
                  for scatter in args["template"].data.scatter
              ]
          if not args["symbol_sequence"] or not any(
              args["symbol_sequence"]
          ):
              args["symbol_sequence"] = [
                  "circle",
                  "diamond",
                  "square",
                  "x",
                  "cross",
              ]
  
      if "line_dash_sequence" in args:
          if (
              args["line_dash_sequence"] is None
              and args["template"].data.scatter
          ):
              args["line_dash_sequence"] = [
                  scatter.line.dash
                  for scatter in args["template"].data.scatter
              ]
          if not args["line_dash_sequence"] or not any(
              args["line_dash_sequence"]
          ):
              args["line_dash_sequence"] = [
                  "solid",
                  "dot",
                  "dash",
                  "longdash",
                  "dashdot",
                  "longdashdot",
              ]
  
      if "pattern_shape_sequence" in args:
          if (
              args["pattern_shape_sequence"] is None
              and args["template"].data.bar
          ):
              args["pattern_shape_sequence"] = [
                  bar.marker.pattern.shape
                  for bar in args["template"].data.bar
              ]
          if not args["pattern_shape_sequence"] or not any(
              args["pattern_shape_sequence"]
          ):
              args["pattern_shape_sequence"] = [
                  "",
                  "/",
                  "\\",
                  "x",
                  "+",
                  ".",
              ]
  
imports: import plotly.graph_objs
  import plotly.io
  from collections import namedtuple, OrderedDict
  from ._special_inputs import IdentityMap, Constant, Range
  from .trendline_functions import ols, lowess, rolling, expanding, ewm
  from _plotly_utils.basevalidators import ColorscaleValidator
  from plotly.colors import qualitative, sequential
  import math
  from packaging import version
  import pandas
  import numpy
  from plotly._subplots import make_subplots, _set_trace_grid_reference, _subplot_type_for_trace_type
label_desc: Use image node_id 22 for calling a global function with example usage: apply_default_cascade(args) without return types