<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def register(self, numerics_alert):
 """Register an alerting numeric event. Args: numerics_alert: An instance of `NumericsAlert`. """

    key = (numerics_alert.device_name, numerics_alert.tensor_name)
    if key in self._data:
      self._data[key].add(numerics_alert)
    else:
      if len(self._data) < self._capacity:
        history = NumericsAlertHistory()
        history.add(numerics_alert)
        self._data[key] = history