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: policy.rb
    path of file: ./repos/aws-sdk-ruby/gems/aws-sdk-iam/lib/aws-sdk-iam
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

# WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE

module Aws::IAM

  class Policy

    extend Aws::Deprecations

    
    def attached_roles(options = {})
      batches = Enumerator.new do |y|
        options = options.merge(
          policy_arn: @arn,
          entity_filter: "Role"
        )
        resp = Aws::Plugins::UserAgent.feature('resource') do
          @client.list_entities_for_policy(options)
        end
        resp.each_page do |page|
          batch = []
          page.data.policy_roles.each do |p|
            batch << Role.new(
              name: p.role_name,
              data: p,
              client: @client
            )
          end
          y.yield(batch)
        end
      end
      Role::Collection.new(batches)
    end