def read_chunked(self, amt=None, decode_content=None):
        self._init_decoder()
        # FIXME: Rewrite this method and make it a class with a better structured logic.
        if not self.chunked:
            raise ResponseNotChunked("Response is not chunked. "
                "Header 'transfer-encoding: chunked' is missing.")

        if self._original_response and self._original_response._method.upper() == 'HEAD':
            # Don't bother reading the body of a HEAD request.
            # FIXME: Can we do this somehow without accessing private httplib _method?
            self._original_response.close()
            return

        while True:
            self._update_chunk_length()
            if self.chunk_left == 0:
                break
            chunk = self._handle_chunk(amt)
            yield self._decode(chunk, decode_content=decode_content,
                               flush_decoder=True)

        # Chunk content ends with \r\n: discard it.
        while True:
            line = self._fp.fp.readline()
            if not line:
                # Some sites may not end with '\r\n'.
                break
            if line == b'\r\n':
                break

        # We read everything; close the "file".
        if self._original_response:
            self._original_response.close()
        self.release_conn()
Similar to :meth:`HTTPResponse.read`, but with an additional
dataset/ETHPy150Open CouchPotato/CouchPotatoServer/libs/requests/packages/urllib3/response.py/HTTPResponse.read_chunked