code: def configure_animation_controls(args, constructor, fig):
      def frame_args(duration):
          return {
              "frame": {
                  "duration": duration,
                  "redraw": constructor != go.Scatter,
              },
              "mode": "immediate",
              "fromcurrent": True,
              "transition": {"duration": duration, "easing": "linear"},
          }
  
      if (
          "animation_frame" in args
          and args["animation_frame"]
          and len(fig.frames) > 1
      ):
          fig.layout.updatemenus = [
              {
                  "buttons": [
                      {
                          "args": [None, frame_args(500)],
                          "label": "&#9654;",
                          "method": "animate",
                      },
                      {
                          "args": [[None], frame_args(0)],
                          "label": "&#9724;",
                          "method": "animate",
                      },
                  ],
                  "direction": "left",
                  "pad": {"r": 10, "t": 70},
                  "showactive": False,
                  "type": "buttons",
                  "x": 0.1,
                  "xanchor": "right",
                  "y": 0,
                  "yanchor": "top",
              }
          ]
          fig.layout.sliders = [
              {
                  "active": 0,
                  "yanchor": "top",
                  "xanchor": "left",
                  "currentvalue": {
                      "prefix": get_label(args, args["animation_frame"])
                      + "="
                  },
                  "pad": {"b": 10, "t": 60},
                  "len": 0.9,
                  "x": 0.1,
                  "y": 0,
                  "steps": [
                      {
                          "args": [[f.name], frame_args(0)],
                          "label": f.name,
                          "method": "animate",
                      }
                      for f in fig.frames
                  ],
              }
          ]
  
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 18 for calling a global function with example usage: configure_animation_controls(args, constructor, fig) and returns: dict