def _update_children(self):
        raise not self._in_update_children or AssertionError
        self._in_update_children = True
        self._children = self._get_children_from_model()
        self._state = map(compose(self._get_state_from_model, second), self._children)
        self.notify_children()
        for idx, value in enumerate(self._state):
            self.notify_state(idx, value)

        self._in_update_children = False
    def _update_children(self):
        raise not self._in_update_children or AssertionError
        self._in_update_children = True
        self._children = self._get_children_from_model()
        self._state = map(compose(self._get_state_from_model, second), self._children)
        self.notify_children()
        for idx, value in enumerate(self._state):
            self.notify_state(idx, value)

        self._in_update_children = False
    def _update_children(self):
        self._in_update_children = True
        self._children = self._get_children_from_model()
        self._state = list(
            map(compose(self._get_state_from_model, second), self._children))
        self.notify_children()
        for idx, value in enumerate(self._state):
            self.notify_state(idx, value)

        self._in_update_children = False
def playing_clip_slot(track):
    slot = playing_or_recording_clip_slot(track)
    if liveobj_valid(slot):
        if not slot.is_recording:
            return slot


def recording_clip_slot(track):
    slot = playing_or_recording_clip_slot(track)
    if liveobj_valid(slot):
        if slot.is_recording:
            return slot


playing_or_recording_clip = compose(clip_of_slot,
                                    playing_or_recording_clip_slot)
playing_clip = compose(clip_of_slot, playing_clip_slot)
recording_clip = compose(clip_of_slot, recording_clip_slot)


@depends(song=(const(None)))
def get_or_create_first_empty_clip_slot(track, song=None):
    if liveobj_valid(track):
        first_empty_slot = find_if(lambda s: not s.has_clip, track.clip_slots)
        if first_empty_slot:
            if liveobj_valid(first_empty_slot):
                return first_empty_slot
        try:
            song.create_scene(-1)
            slot = track.clip_slots[(-1)]
            if liveobj_valid(slot):