moved more ruby code from prepare_plan_participant.rb to python