<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _weights_callback(self, msg):
 """Callback for recording weights from sensor. """

        # Read weights
        weights = np.array(msg.data)

        # If needed, initialize indiv_weight_buffers
        if len(self._weight_buffers) == 0:
            self._weight_buffers = [[] for i in range(len(weights))]

        # Record individual weights
        for i, w in enumerate(weights):
            if len(self._weight_buffers[i]) == self._ntaps:
                self._weight_buffers[i].pop(0)
            self._weight_buffers[i].append(w)