<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def unique_name(self, name):
 """ Generates a unique name. :param name: the name to check :type name: str :return: the unique name :rtype: str """

        result = name

        if self.parent is not None:
            index = self.index
            bname = re.sub(r'-[0-9]+$', '', name)
            names = []
            for idx, actor in enumerate(self.parent.actors):
                if idx != index:
                    names.append(actor.name)
            result = bname
            count = 0
            while result in names:
                count += 1
                result = bname + "-" + str(count)

        return result