<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _assert_valid_key(self, name):
 """Raises if name is not a valid measurement."""

    if name not in self._measurements:
      raise NotAMeasurementError('Not a measurement', name, self._measurements)