def METHOD_NAME(self, method, path, headers=None, body=None):
    hostport = '%s:%s' % (self.host, self.port)
    fullurl = '%s://%s%s' % (self.scheme, hostport, path)
    logger.debug("Requesting %s %s.", method, fullurl)
    headers = headers or {}
    if self._cookies:
        headers.setdefault('Cookie', "\n".join(self._cookies))
    if body:
        headers['Content-Type'] = 'application/json'
    if hasattr(body, 'pop'):  # list or dict
        body = json.dumps(body)
    if body is not None:
        body = ensure_bytes(body)
    if 'https' == self.scheme:
        conn = http.client.HTTPSConnection(
            self.host, self.port, context=self.ssl_context, timeout=30,
        )
    else:
        conn = http.client.HTTPConnection(
            self.host, self.port, timeout=30,
        )
    conn.response_class = TemboardResponse
    if self.log_headers:
        for name, value in sorted(headers.items()):
            logger.debug(">>> %s: %s", name, value)
    start_time = time()
    conn.METHOD_NAME(method, path, body, headers)
    response = conn.getresponse()
    duration = time() - start_time
    response.path = path
    if self.log_headers:
        for name, value in sorted(response.headers.items()):
            logger.debug("<<< %s: %s", name, value)
    if response.headers['set-cookie']:
        cookie = response.headers['set-cookie']
        logger.debug("Registering cookie %.16s... in session.", cookie)
        self._cookies.add(cookie)
    logger.debug(
        "Response from %s in %.3fs: %s.", hostport, duration, response)
    return response