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: time_series_storable.rb
    path of file: ./repos/gitlabhq/lib/gitlab/usage
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

module Gitlab
  module Usage
    module TimeSeriesStorable
      # requires a #redis_key(event, date, used_i
    
      def keys_for_aggregation(events:, start_date:, end_date:, used_in_aggregate_metric: false)
        # we always keep 1 week of margin
        # .end_of_week is necessary to make sure this works for 1 week long periods too
        end_date = end_date.end_of_week - 1.week
        (start_date.to_date..end_date.to_date).flat_map do |date|
          events.map { |event| redis_key(event, date, used_in_aggregate_metric) }
        end.uniq
      end

      def apply_time_aggregation(key, time)
        year_week = time.strftime('%G-%V')
        "#{key}-#{year_week}"
      end
    end