import socket


def authenticate(port, password):
    """
    Authentication function used in all testcases to authenticate with server
    """
    s = socket.socket(family=socket.AF_INET, type=socket.SOCK_DGRAM)
    s.sendto(b"AUTH %s" % password, ("127.0.0.1", port))
    msg, addr = s.recvfrom(1024)
    return (s, msg.strip())