def create_client() -> APIClient:
global _client<EOL>client = _client()<EOL>if client is None:<EOL><INDENT>docker_environment = kwargs_from_env(assert_hostname=False)<EOL>if "<STR_LIT>" in docker_environment:<EOL><INDENT>client = _create_client(docker_environment.get("<STR_LIT>"), docker_environment.get("<STR_LIT>"))<EOL>if client is None:<EOL><INDENT>raise ConnectionError(<EOL>"<STR_LIT>"<EOL>% docker_environment)<EOL><DEDENT>else:<EOL><INDENT>logging.info("<STR_LIT>")<EOL><DEDENT><DEDENT>else:<EOL><INDENT>client = _create_client("<STR_LIT>")<EOL>if client is not None:<EOL><INDENT>logging.info("<STR_LIT>")<EOL><DEDENT>else:<EOL><INDENT>raise ConnectionError(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT><DEDENT>_client = weakref.ref(client)<EOL><DEDENT>assert isinstance(client, APIClient)<EOL>return client<EOL>
Clients a Docker client.

Will raise a `ConnectionError` if the Docker daemon is not accessible.
:return: the Docker client