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: port.go
    path of file: ./repos/devspace/helper/util/port
    
    the code of the file until where you have to start completion: package port

import (
	"net"
	"time"
)

func 
    
func IsAvailable(addr string) (bool, error) {
	timeout := time.Millisecond * 500
	conn, err := net.DialTimeout("tcp", addr, timeout)
	if err != nil {
		// Try to create a server with the port
		server, err := net.Listen("tcp", addr)

		// if it fails then the port is likely taken
		if err != nil {
			return false, err
		}

		// close the server
		_ = server.Close()
		return true, nil
	}
	_ = conn.Close()
	return false, nil
}