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: xml_steps.rb
    path of file: ./repos/sequencescape/features/support/step_definitions
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

def sort_arrays(xml_data)
  case xml_data
  when Hash
    xml_data.transform_values { |v|
    
def sort_arrays(xml_data)
  case xml_data
  when Hash
    xml_data.transform_values { |v| sort_arrays(v) }
  when Array
    # Kind of a hack but works for the cases where Hash elements exist
    xml_data.map { |e| sort_arrays(e) }.sort_by(&:to_a)
  else
    xml_data
  end