'LXD Client.
:param url: The URL of the LXD server. (e.g. unix:/var/lib/lxd/unix.socket or https://127.0.0.1)
:type url: ``str``
:param key_file: The path of the client certificate key file.
:type key_file: ``str``
:param cert_file: The path of the client certificate file.
:type cert_file: ``str``
:param debug: The debug flag. The request and response are stored in logs when debug is true.
:type debug: ``bool``'

def __init__(self, url, key_file=None, cert_file=None, debug=False):

    self.url = url
    self.debug = debug
    self.logs = []
    if url.startswith('https:'):
        self.cert_file = cert_file
        self.key_file = key_file
        parts = generic_urlparse(urlparse(self.url))
        ctx = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
        ctx.load_cert_chain(cert_file, keyfile=key_file)
        self.connection = HTTPSConnection(parts.get('netloc'), context=ctx)
    elif url.startswith('unix:'):
        unix_socket_path = url[len('unix:'):]
        self.connection = UnixHTTPConnection(unix_socket_path)
    else:
        raise LXDClientException('URL    scheme    must    be    unix:    or    https:')
