<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def GenerateId(self, entity_id=None):
 """Generate a unique id based on the given id. This is done by appending a counter which is then incremented. The counter is initialised at the maximum number used as an ending for any id in the old and new schedules. Args: entity_id: The base id string. This is allowed to be None. Returns: The generated id. """

    self._idnum += 1
    if entity_id:
      return '%s_merged_%d' % (entity_id, self._idnum)
    else:
      return 'merged_%d' % self._idnum