Factory function returning appropriate XML writer object for
    *chart_type*, loaded with *chart_type* and *chart_data*.

def ChartXmlWriter(chart_type, chart_data):
    """
    Factory function returning appropriate XML writer object for
    *chart_type*, loaded with *chart_type* and *chart_data*.
    """
    XL_CT = XL_CHART_TYPE
    try:
        BuilderCls = {
            XL_CT.AREA:                         _AreaChartXmlWriter,
            XL_CT.AREA_STACKED:                 _AreaChartXmlWriter,
            XL_CT.AREA_STACKED_100:             _AreaChartXmlWriter,
            XL_CT.BAR_CLUSTERED:                _BarChartXmlWriter,
            XL_CT.BAR_STACKED:                  _BarChartXmlWriter,
            XL_CT.BAR_STACKED_100:              _BarChartXmlWriter,
            XL_CT.BUBBLE:                       _BubbleChartXmlWriter,
            XL_CT.BUBBLE_THREE_D_EFFECT:        _BubbleChartXmlWriter,
            XL_CT.COLUMN_CLUSTERED:             _BarChartXmlWriter,
            XL_CT.COLUMN_STACKED:               _BarChartXmlWriter,
            XL_CT.COLUMN_STACKED_100:           _BarChartXmlWriter,
            XL_CT.DOUGHNUT:                     _DoughnutChartXmlWriter,
            XL_CT.DOUGHNUT_EXPLODED:            _DoughnutChartXmlWriter,
            XL_CT.LINE:                         _LineChartXmlWriter,
            XL_CT.LINE_MARKERS:                 _LineChartXmlWriter,
            XL_CT.LINE_MARKERS_STACKED:         _LineChartXmlWriter,
            XL_CT.LINE_MARKERS_STACKED_100:     _LineChartXmlWriter,
            XL_CT.LINE_STACKED:                 _LineChartXmlWriter,
            XL_CT.LINE_STACKED_100:             _LineChartXmlWriter,
            XL_CT.PIE:                          _PieChartXmlWriter,
            XL_CT.PIE_EXPLODED:                 _PieChartXmlWriter,
            XL_CT.RADAR:                        _RadarChartXmlWriter,
            XL_CT.RADAR_FILLED:                 _RadarChartXmlWriter,
            XL_CT.RADAR_MARKERS:                _RadarChartXmlWriter,
            XL_CT.XY_SCATTER:                   _XyChartXmlWriter,
            XL_CT.XY_SCATTER_LINES:             _XyChartXmlWriter,
            XL_CT.XY_SCATTER_LINES_NO_MARKERS:  _XyChartXmlWriter,
            XL_CT.XY_SCATTER_SMOOTH:            _XyChartXmlWriter,
            XL_CT.XY_SCATTER_SMOOTH_NO_MARKERS: _XyChartXmlWriter,
        }[chart_type]
    except KeyError:
        raise NotImplementedError(
            'XML writer for chart type %s not yet implemented' % chart_type
        )
    return BuilderCls(chart_type, chart_data)