<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _on_capacity_data(self, conn, command, kwargs, response, capacity):
 """ Log the received consumed capacity data """

        if self._analyzing:
            self.consumed_capacities.append((command, capacity))
        if self._query_rate_limit is not None:
            self._query_rate_limit.on_capacity(
                conn, command, kwargs, response, capacity
            )
        elif self.rate_limit is not None:
            self.rate_limit.callback = self._on_throttle
            self.rate_limit.on_capacity(conn, command, kwargs, response, capacity)