def container_status_for_ui(container_statuses):
    """
        Summarize the container status based on its most recent state

        Parameters
        ----------
        container_statuses : list[V1ContainerStatus]
            https://github.com/kubernetes-client/python/blob/master/kubernetes/docs/V1ContainerStatus.md
    """
    if container_statuses is None:
        return None

    assert(len(container_statuses) == 1)

    state = container_statuses[0].state

    if state.running:
        return {"running": {"started_at": state.running.started_at}}

    if state.waiting:
        return {"waiting": {"reason": state.waiting.reason}}

    if state.terminated:
        return {"terminated": {
                                "exit_code": state.terminated.exit_code,
                                "finished_at": state.terminated.finished_at,
                                "started_at": state.terminated.started_at,
                                "reason": state.terminated.reason
                              }
                }