# File lib/fog/aws/requests/compute/request_spot_instances.rb, line 59
        def request_spot_instances(image_id, instance_type, spot_price, options = {})
          if block_device_mapping = options.delete('LaunchSpecification.BlockDeviceMapping')
            block_device_mapping.each_with_index do |mapping, index|
              for key, value in mapping
                options.merge!({ format("LaunchSpecification.BlockDeviceMapping.%d.#{key}", index) => value })
              end
            end
          end
          if security_groups = options.delete('LaunchSpecification.SecurityGroup')
            options.merge!(Fog::AWS.indexed_param('LaunchSpecification.SecurityGroup', [*security_groups]))
          end
          if security_group_ids = options.delete('LaunchSpecification.SecurityGroupId')
            options.merge!(Fog::AWS.indexed_param('LaunchSpecification.SecurityGroupId', [*security_group_ids]))
          end
          if options['LaunchSpecification.UserData']
            options['LaunchSpecification.UserData'] = Base64.encode64(options['LaunchSpecification.UserData'])
          end

          request({
            'Action'                            => 'RequestSpotInstances',
            'LaunchSpecification.ImageId'       => image_id,
            'LaunchSpecification.InstanceType'  => instance_type,
            'SpotPrice'                         => spot_price,
            :parser                             => Fog::Parsers::Compute::AWS::SpotInstanceRequests.new
          }.merge!(options))
        end