<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _did_count(self, connection):
 """ Called when count if finished """


        self.current_connection = connection
        response = connection.response
        count = 0
        callback = None

        if 'X-Nuage-Count' in response.headers:
            count = int(response.headers['X-Nuage-Count'])

        if 'remote' in connection.callbacks:
            callback = connection.callbacks['remote']

        if connection.async:
            if callback:
                callback(self, self.parent_object, count)

                self.current_connection.reset()
                self.current_connection = None
        else:

            if connection.response.status_code >= 400 and BambouConfig._should_raise_bambou_http_error:
                raise BambouHTTPError(connection=connection)

            return (self, self.parent_object, count)