code: def qq_plot(model, ax=None, scatter_color="k", **plot_kwargs):
      """
      Produces a quantile-quantile plot of the empirical CDF against
      the fitted parametric CDF. Large deviances away from the line y=x
      can invalidate a model (though we expect some natural deviance in the tails).
  
      Parameters
      -----------
      model: obj
          A fitted lifelines univariate parametric model, like ``WeibullFitter``
      plot_kwargs:
          kwargs for the plot.
  
      Returns
      --------
      ax:
          The axes which was used.
  
      Examples
      ---------
      .. code:: python
  
          from lifelines import *
          from lifelines.plotting import qq_plot
          from lifelines.datasets import load_rossi
          df = load_rossi()
          wf = WeibullFitter().fit(df['week'], df['arrest'])
          qq_plot(wf)
  
      Notes
      ------
      The interval censoring case uses the mean between the upper and lower bounds.
  
      """
      from lifelines.utils import qth_survival_times
      from lifelines import KaplanMeierFitter
      from matplotlib import pyplot as plt
  
      if ax is None:
          ax = plt.gca()
      dist = get_distribution_name_of_lifelines_model(model)
      dist_object = create_scipy_stats_model_from_lifelines_model(model)
  
      COL_EMP = "empirical quantiles"
      COL_THEO = "fitted %s quantiles" % dist
  
      if CensoringType.is_left_censoring(model):
          kmf = KaplanMeierFitter().fit_left_censoring(
              model.durations,
              model.event_observed,
              label=COL_EMP,
              weights=model.weights,
              entry=model.entry,
          )
          sf, cdf = (
              kmf.survival_function_[COL_EMP],
              kmf.cumulative_density_[COL_EMP],
          )
      elif CensoringType.is_right_censoring(model):
          kmf = KaplanMeierFitter().fit_right_censoring(
              model.durations,
              model.event_observed,
              label=COL_EMP,
              weights=model.weights,
              entry=model.entry,
          )
          sf, cdf = (
              kmf.survival_function_[COL_EMP],
              kmf.cumulative_density_[COL_EMP],
          )
      elif CensoringType.is_interval_censoring(model):
          kmf = KaplanMeierFitter().fit_interval_censoring(
              model.lower_bound,
              model.upper_bound,
              label=COL_EMP,
              weights=model.weights,
              entry=model.entry,
          )
          sf, cdf = (
              kmf.survival_function_.mean(1),
              kmf.cumulative_density_[COL_EMP + "_lower"],
          )
      q = np.unique(cdf.values)
  
      quantiles = qth_survival_times(1 - q, sf)
      quantiles[COL_THEO] = dist_object.ppf(q)
      quantiles = quantiles.replace(
          [-np.inf, 0, np.inf], np.nan
      ).dropna()
  
      max_, min_ = quantiles[COL_EMP].max(), quantiles[COL_EMP].min()
  
      quantiles.plot.scatter(
          COL_THEO,
          COL_EMP,
          c="none",
          edgecolor=scatter_color,
          lw=0.5,
          ax=ax,
      )
      ax.plot([min_, max_], [min_, max_], c="k", ls=":", lw=1.0)
      ax.set_ylim(min_, max_)
      ax.set_xlim(min_, max_)
  
      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 6 for calling a global function with example usage: qq_plot(model, ax, scatter_color) and returns: ax