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: webmock.rb
    path of file: ./repos/gitlabhq/spec/support
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

require 'webmock'
require '
    
def allowed_host_and_ip(url)
  host = URI.parse(url).host
  ip_address = Addrinfo.ip(host).ip_address

  allowed = [host, ip_address]

  # Sometimes IPv6 address has square brackets around it
  parsed_ip = IPAddr.new(ip_address)
  allowed << "[#{ip_address}]" if parsed_ip.ipv6?

  allowed
end