def METHOD_NAME(self, value):
    for index, row in enumerate(self):
        if value == row[self.C_COMMAND]:
            return index
    last_row = self[-1]
    name = _('Command: %s') % value
    if last_row[self.C_CUSTOM]:
        last_row[self.C_COMMAND] = value
        last_row[self.C_NAME] = name
    else:
        self.append((None, name, value, True))
    return len(self) - 1