<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def state(self, state):
 """Set enum metric state."""

        with self._lock:
            self._value = self._states.index(state)