<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def statsId(obj):
 """Gets a unique ID for each object."""

  if hasattr(obj, ID_KEY):
    return getattr(obj, ID_KEY)
  newId = next(NEXT_ID)
  setattr(obj, ID_KEY, newId)
  return newId