import attr


def _procs_to_df(procs):
    """Convert the SIProcess objects recursively to a list."""
    df_list = []
    for proc in procs:
        df_list.append(attr.asdict(proc))
        if proc.children:
            df_list.extend(_procs_to_df(proc.children))
    return df_list