<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def new(self, kind, **extra):
 """ Return a host name for a new node of the given kind. The new name is formed by interpolating ``{}``-format specifiers in the string given as ``pattern`` argument to the class constructor. The following names can be used in the ``{}``-format specifiers: * ``kind`` -- the `kind` argument * ``index`` -- a positive integer number, garanteed to be unique (per kind) * any other keyword argument used in the call to :meth:`new` Example:: 'node-foo-1bar' 'node-foo-2quux' """

        if self._free[kind]:
            index = self._free[kind].pop()
        else:
            self._top[kind] += 1
            index = self._top[kind]
        return self._format(self.pattern, kind=kind, index=index, **extra)