/**
  * Creates a duplicate of the line item tree, except only includes billable items
  * and the portion of line items attributed to billable things
  * @param EE_Line_Item      $line_item
  * @param EE_Registration[] $registrations
  * @return \EE_Line_Item
  */
 public static function billable_line_item_tree(EE_Line_Item $line_item, $registrations)
 {
     $copy_li = EEH_Line_Item::billable_line_item($line_item, $registrations);
     foreach ($line_item->children() as $child_li) {
         $copy_li->add_child_line_item(EEH_Line_Item::billable_line_item_tree($child_li, $registrations));
     }
     //if this is the grand total line item, make sure the totals all add up
     //(we could have duplicated this logic AS we copied the line items, but
     //it seems DRYer this way)
     if ($copy_li->type() === EEM_Line_Item::type_total) {
         $copy_li->recalculate_total_including_taxes();
     }
     return $copy_li;
 }