def __init__(self, sock, **config):
        self.defunct = False
        self.channel = ChunkChannel(sock)
        self.packer = Packer(self.channel)
        self.responses = deque()
        self.closed = False

        # Determine the user agent and ensure it is a Unicode value
        user_agent = config.get("user_agent", DEFAULT_USER_AGENT)
        if isinstance(user_agent, bytes):
            user_agent = user_agent.decode("UTF-8")
        self.user_agent = user_agent

        # Determine auth details
        try:
            self.auth_dict = vars(config["auth"])
        except (KeyError, __HOLE__):
            self.auth_dict = {}

        # Pick up the server certificate, if any
        self.der_encoded_server_certificate = config.get("der_encoded_server_certificate")

        def on_failure(metadata):
            raise ProtocolError(metadata.get("message", "Inititalisation failed"))

        response = Response(self)
        response.on_failure = on_failure

        self.append(INIT, (self.user_agent, self.auth_dict), response=response)
        self.send()
        while not response.complete:
            self.fetch()
dataset/ETHPy150Open nigelsmall/py2neo/py2neo/packages/neo4j/v1/connection.py/Connection.__init__