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: datasources.rb
    path of file: ./repos/arcgis-cookbook/cookbooks/arcgis-enterprise/providers
    
    the code of the file until where you have to start completion: #
# Cookbook Name:: arcgis-enterprise
# Provider:: datasources
#
# Copyright 2018 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
# distr
    
def get_server_url
  # retrieve URL to configure ArcGIS Server via HTTPS:
  # 1. Check whether a dedicated parameter has been specified
  # 2. Read the SSL certificate and construct the URL out of the certificat's subject name
  # 3. Use existing Cookbook parameter as fallback (high chance that this results in certificate errors)
  if !node['arcgis']['datasources']['server_config_url'].nil?
    server_url = node['arcgis']['datasources']['server_config_url'] + "/admin"
  else
    if ::File.exist?(node['arcgis']['server']['keystore_file'])
      p12 = OpenSSL::PKCS12.new(::File.binread(node['arcgis']['server']['keystore_file']), node['arcgis']['server']['keystore_password'])
      cert = p12.certificate
      cert_cn = cert.subject.to_a.select{|name, _, _| name == 'CN' }.first[1]
      
      server_url = 'https://' + cert_cn + ":6443/arcgis/admin"
    else
      server_url = node['arcgis']['server']['url'] + "/admin"
    end