def create_clip_in_selected_slot(creator, song, clip_length=None):
    """
    Create a new clip in the selected slot of if none exists, using a
    given creator object.  Fires it if the song is playing and
    displays it in the detail view.
    """
    selected_slot = song.view.highlighted_clip_slot
    if creator and selected_slot and not selected_slot.has_clip:
        creator.create(selected_slot, clip_length, legato_launch=True)
        song.view.detail_clip = selected_slot.clip
    return selected_slot.clip