<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def rename(self, arr, new_name=True):
 """ Rename an array to find a name that isn't already in the list Parameters arr: InteractiveBase A :class:`InteractiveArray` or :class:`InteractiveList` instance whose name shall be checked new_name: bool or str If False, and the ``arr_name`` attribute of the new array is already in the list, a ValueError is raised. If True and the ``arr_name`` attribute of the new array is not already in the list, the name is not changed. Otherwise, if the array name is already in use, `new_name` is set to 'arr{0}'. If not True, this will be used for renaming (if the array name of `arr` is in use or not). ``'{0}'`` is replaced by a counter Returns ------- InteractiveBase `arr` with changed ``arr_name`` attribute bool or None True, if the array has been renamed, False if not and None if the array is already in the list Raises ------ ValueError If it was impossible to find a name that isn't already in the list ValueError If `new_name` is False and the array is already in the list"""

        name_in_me = arr.psy.arr_name in self.arr_names
        if not name_in_me:
            return arr, False
        elif name_in_me and not self._contains_array(arr):
            if new_name is False:
                raise ValueError(
                    "Array name %s is already in use! Set the `new_name` "
                    "parameter to None for renaming!" % arr.psy.arr_name)
            elif new_name is True:
                new_name = new_name if isstring(new_name) else 'arr{0}'
                arr.psy.arr_name = self.next_available_name(new_name)
                return arr, True
        return arr, None