Constructs a configuration object from an existing client instance. If the client has already been created with
        a configuration object, returns that instance.

        :param client: Client object to derive the configuration from.
        :type client: docker.client.Client
        :return: ClientConfiguration

def from_client(cls, client):
        """
        Constructs a configuration object from an existing client instance. If the client has already been created with
        a configuration object, returns that instance.

        :param client: Client object to derive the configuration from.
        :type client: docker.client.Client
        :return: ClientConfiguration
        """
        if hasattr(client, 'client_configuration'):
            return client.client_configuration
        kwargs = {'client': client}
        for attr in cls.init_kwargs:
            if hasattr(client, attr):
                kwargs[attr] = getattr(client, attr)
        if hasattr(client, 'api_version'):
            kwargs['version'] = client.api_version
        return cls(**kwargs)