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

require 'wings/converter_value_mapper'
require 'wings/active_fedora_converter/default_work'
require 'wings/active_fedora_converter/file_metadata_node'
require 'wings/active_fedora_converter/instance_builder'
require 'wings/active_fedora_converter/nested_resource'

module Wings
  ##
  # Converts `Valkyrie::Resource` objects to legacy `ActiveFedora::
    
    def perform_lease_conversion(af_object:, resource:)
      # TODO(#6134): af_object.lease.class has the same name as resource.lease.class; however, each class has a different object_id
      # so a type mismatch happens. the code below coerces the one object into the other
      return if !resource.try(:lease) || !af_object.reflections.include?(:lease) || af_object.lease&.id

      resource_lease_dup = af_object.reflections.fetch(:lease).klass.new(resource.lease.attributes.except(:id, :internal_resource, :created_at, :updated_at, :new_record))
      af_object.lease = resource_lease_dup
    end