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: traces.rb
    path of file: ./repos/dd-trace-rb/lib/datadog/tracing/transport/io
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

require_relative '../../transport/traces'
require_relative '../../../core/transport/parcel'
require_relative 'response'
require_relative 'client'

module Datadog
  module Tracing
    module Transport
      module IO
        # IO transport behavior for traces
        module Traces
          # Re
    
            def encode_trace(trace)
              # Convert each trace to hash
              trace.spans.map(&:to_hash).tap do |spans|
                # Convert IDs to hexadecimal
                spans.each do |span|
                  ENCODED_IDS.each do |id|
                    span[id] = span[id].to_s(16) if span.key?(id)
                  end
                end
              end
            end