def select_attributes(attributes, data = {})
      attributes = attributes.split(',').map(&:strip).reject(&:empty?).map { |a| a.split('.') } if attributes.is_a?(String)
      r_data = data.is_a?(Hash) ? data : data.data
      temp = {}
      attributes.each do |attr|
        temp_level = temp
        attr = [attr] if attr.is_a?(String)
        attr.each_with_index do |a, index|
          # Safely retrieving and setting nested keys is not as easy, so loop to build a nested Hash structure for the result
          if index == attr.size - 1
            # Use r_data.dig(*attr) if we ever drop support for Ruby < 2.3
            temp_level[a] = [*attr].reduce(r_data) { |m, k| m && m[k] } rescue nil
          else
            temp_level[a] ||= {}
            temp_level = temp_level[a]
          end
        end
      end
      temp
    end
def select_attributes(attributes, data = {})
      attributes = attributes.split(',').map(&:strip).reject(&:empty?).map { |a| a.split('.') } if attributes.is_a?(String)
      r_data = data.is_a?(Hash) ? data : data.data
      temp = {}
      attributes.each do |attr|
        temp_level = temp
        attr = [attr] if attr.is_a?(String)
        attr.each_with_index do |a, index|
          # Safely retrieving and setting nested keys is not as easy, so loop to build a nested Hash structure for the result
          if index == attr.size - 1
            # Use r_data.dig(*attr) if we ever drop support for Ruby < 2.3
            temp_level[a] = [*attr].reduce(r_data) { |m, k| m && m[k] } rescue nil
          else
            temp_level[a] ||= {}
            temp_level = temp_level[a]
          end
        end
      end
      temp
    end
Select a subset of attributes from a given resource
 @param attributes [String, Array<Array<String>>] Comma-separated string or array of array of strings
   The reason it's a nested array is to allow retrieval of nested keys.
   For example, the following 2 attribute params will return the same result:
     - [['key1'], ['key2', 'subKey3']]
     - 'key1,key2.subKey3'
 @param data [Hash, OneviewSDK::Resource]
 @return [Hash] A Hash is returned. For example:
   { 'key1' => 'val1', 'key2' => { 'subKey3' => 'val2' } }