code: def adapt(chart, data):
      """Adapt data to chart type"""
      if isinstance(chart, pygal.XY):
          return data
  
      data = cut(data)
      if isinstance(chart, BaseMap):
          return list(
              map(
                  lambda x: chart.__class__.x_labels[
                      int(x) % len(chart.__class__.x_labels)
                  ]
                  if x is not None
                  else None,
                  data,
              )
          )
      return data
  
imports: from decimal import Decimal
  import pygal
  from pygal.graph.map import BaseMap
  from pygal.util import cut
label_desc: Use image node_id 2 for calling a global function with example usage: adapt(chart, data) and returns: data, data, list