code: def _heatmap_options(
      locations,
      weights,
      max_intensity,
      dissipating,
      point_radius,
      opacity,
      gradient,
  ):
      options = {
          "max_intensity": max_intensity,
          "dissipating": dissipating,
          "point_radius": point_radius,
          "opacity": opacity,
          "gradient": gradient,
      }
      if weights is None:
          is_weighted = False
          widget_args = {"locations": locations}
      else:
          if len(weights) != len(locations):
              raise ValueError(
                  "weights must be of the same length as locations or None"
              )
          is_weighted = True
          widget_args = {"locations": locations, "weights": weights}
      widget_args.update(options)
      return widget_args, is_weighted
  
imports: import ipywidgets
  from traitlets import Float, Bool, Unicode, HasTraits, default, List, observe
  from .None import bounds
  from .locations import locations_docstring
  from .None import geotraitlets
  from .maps import GMapsWidgetMixin
  from ._docutils import doc_subst
label_desc: Use image node_id 1 for calling a global function with example usage: _heatmap_options(locations, weights, max_intensity, dissipating, point_radius, opacity, gradient) and returns: widget_args,  is_weighted