You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: service_order.rb
    path of file: ./repos/manageiq/app/models
    
    the code of the file until where you have to start completion: class ServiceOrder < ApplicationRecord
  STATE_CART    = 'cart'.freeze
  STATE_WISH    = 'wish'.freeze
  STATE_ORDERED = 'ordered'.freeze
  REQUEST_ATT
    
  def deep_copy(new_attributes = {})
    raise _("Cannot copy a service order in the %{state} state") % {:state => STATE_CART} if state == STATE_CART

    dup.tap do |new_service_order|
      # Set it to nil - the after_create hook will give it the correct name
      new_service_order.name = nil
      # Should be put back into the Cart state
      new_service_order.state = STATE_CART
      new_service_order.miq_requests = miq_requests.collect do |request|
        request.class.send(:create, request.attributes.except(*REQUEST_ATTRIBUTES))
      end
      new_attributes.each do |attr, value|
        new_service_order.send(:"#{attr}=", value) if self.class.attribute_names.include?(attr.to_s)
      end
      new_service_order.save!
    end
  end