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: widget_import_validator.rb
    path of file: ./repos/manageiq/app/models
    
    the code of the file until where you have to start completion: class WidgetImportValidator
  class InvalidWidgetYamlError < StandardError; end
  class NonYamlError < StandardError; end

  def determine_validity(import_file_upload)
    widgets = 
    
  def determine_validity(import_file_upload)
    widgets = YAML.load(import_file_upload.uploaded_content)

    raise InvalidWidgetYamlError unless widgets.all? do |widget_or_key, _|
      widget_or_key["MiqWidget"] || widget_or_key == "MiqWidget"
    end
  rescue Psych::SyntaxError
    raise NonYamlError
  rescue
    raise InvalidWidgetYamlError
  end