def process_to_dict(process):
  """Return nested dicts for the nested namedtuples of a process."""
  # These lines are sort of like a deep version of _asdict().
  stages = [stage._asdict() for stage in process.stages]
  for stage in stages:
    stage['progress_items'] = [pi._asdict() for pi in stage['progress_items']]
    stage['actions'] = [act._asdict() for act in stage['actions']]
    stage['approvals'] = [appr._asdict() for appr in stage['approvals']]

  process_dict = {
      'name': process.name,
      'description': process.description,
      'applicability': process.applicability,
      'stages': stages,
  }
  return process_dict