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: utils.rb
    path of file: ./repos/arcgis-cookbook/cookbooks/arcgis-enterprise/libraries
    
    the code of the file until where you have to start completion: #
# Copyright 2022 Esri
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

require 'net/http'
require 'uri'
require 'json'
require 'pathname'

if RUBY_PLATFORM =~ /mswin|mingw32|windows/
  require 'win32/registry'
  require 'win32ole'
end

#
# Utilities used by various arcgis cookbook resources.
#
module Utils
  MAX_RETRIES = 100
  SLEEP_TIME = 10.0

  def self.url_available?(url, redirects = 0)
    uri = UR
    
  def self.directory_accessible?(dir, user, password)
    return false if dir.nil? || dir == '' || user.nil? || user == ''

    begin
      if RUBY_PLATFORM =~ /mswin|mingw32|windows/
        cmd = Mixlib::ShellOut.new("dir \"#{dir}\"", {:user => user, :password => password, :timeout => 60})
        cmd.run_command
        exists = !cmd.error?

       if !exists
         cmd = Mixlib::ShellOut.new("mkdir \"#{dir}\"", {:user => user, :password => password, :timeout => 60})
         cmd.run_command
         cmd.error!

         cmd = Mixlib::ShellOut.new("rmdir \"#{dir}\"", {:user => user, :password => password, :timeout => 60})
         cmd.run_command
         cmd.error!
       else
         test_file = ::File.join(dir, "test.tmp")

         cmd = Mixlib::ShellOut.new("echo.>\"#{test_file}\"", {:user => user, :password => password, :timeout => 60})
         cmd.run_command
         cmd.error!

         cmd = Mixlib::ShellOut.new("del \"#{test_file}\"", {:user => user, :password => password, :timeout => 60})
         cmd.run_command
         cmd.error!
       end