code: def cdf_plot(model, timeline=None, ax=None, **plot_kwargs):
      """
      This plot compares the empirical CDF (derived by KaplanMeier) vs the model CDF.
  
      Parameters
      ------------
      model: lifelines univariate model
      timeline: iterable
      ax: matplotlib axis
  
      """
      from lifelines import KaplanMeierFitter
      from matplotlib import pyplot as plt
  
      if ax is None:
          ax = plt.gca()
      if timeline is None:
          timeline = model.timeline
      COL_EMP = "empirical CDF"
  
      if CensoringType.is_left_censoring(model):
          empirical_kmf = KaplanMeierFitter().fit_left_censoring(
              model.durations,
              model.event_observed,
              label=COL_EMP,
              timeline=timeline,
              weights=model.weights,
              entry=model.entry,
          )
      elif CensoringType.is_right_censoring(model):
          empirical_kmf = KaplanMeierFitter().fit_right_censoring(
              model.durations,
              model.event_observed,
              label=COL_EMP,
              timeline=timeline,
              weights=model.weights,
              entry=model.entry,
          )
      elif CensoringType.is_interval_censoring(model):
          empirical_kmf = KaplanMeierFitter().fit_interval_censoring(
              model.lower_bound,
              model.upper_bound,
              label=COL_EMP,
              timeline=timeline,
              weights=model.weights,
              entry=model.entry,
          )
      empirical_kmf.plot_cumulative_density(ax=ax, **plot_kwargs)
  
      dist = get_distribution_name_of_lifelines_model(model)
      dist_object = create_scipy_stats_model_from_lifelines_model(model)
      ax.plot(
          timeline,
          dist_object.cdf(timeline),
          label="fitted %s" % dist,
          **plot_kwargs,
      )
      ax.legend()
      return ax
  
imports: import warnings
  from typing import Union, Optional, Iterable
  from scipy import stats
  import pandas
  import numpy
  from lifelines.utils import coalesce, CensoringType, _group_event_table_by_intervals
label_desc: Use image node_id 4 for calling a global function with example usage: cdf_plot(model, timeline, ax) and returns: ax