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: parent_work_navigator.rb
    path of file: ./repos/hyrax/app/services/hyrax/custom_queries/navigators
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

module Hyrax
  module CustomQueries
    module Navigators
      ##
      # Navigate from a resource to it's parent work.
      #
      # @see https://github.com/samvera/valkyrie/wiki/Queries#custom-quer
    
        def find_parent_work(resource:)
          results = Hyrax.query_service.find_inverse_references_by(resource: resource,
                                                                   property: :member_ids).select(&:work?)
          if results.count > 1
            Hyrax.logger.warn("#{resource.work? ? 'Work' : 'File set'} " \
                              "#{resource.id} is in #{results.count} works when it " \
                              "should be in no more than one. Found in #{results.map(&:id).join(', ')}.")
          end