def _create_container_for_process(pymux, window, arrangement_pane, zoom=False):
    """
    Create a `Container` with a titlebar for a process.
    """
    @Condition
    def clock_is_visible():
        return arrangement_pane.clock_mode

    @Condition
    def pane_numbers_are_visible():
        return pymux.display_pane_numbers

    terminal_is_focused = has_focus(arrangement_pane.terminal)

    def get_terminal_style():
        if terminal_is_focused():
            result = 'class:terminal.focused'
        else:
            result = 'class:terminal'
        return result

    def get_titlebar_text_fragments():
        result = []

        if zoom:
            result.append(('class:titlebar-zoom', ' Z '))

        if arrangement_pane.process.is_terminated:
            result.append(('class:terminated', ' Terminated '))

        # Scroll buffer info.
        if arrangement_pane.display_scroll_buffer:
            result.append(('class:copymode', ' %s ' % arrangement_pane.scroll_buffer_title))

            # Cursor position.
            document = arrangement_pane.scroll_buffer.document
            result.append(('class:copymode.position', ' %i,%i ' % (
                document.cursor_position_row, document.cursor_position_col)))

        if arrangement_pane.name:
            result.append(('class:name', ' %s ' % arrangement_pane.name))
            result.append(('', ' '))

        return result + [
            ('', format_pymux_string(pymux, ' #T ', pane=arrangement_pane))  # XXX: Make configurable.
        ]

    def get_pane_index():
        try:
            w = pymux.arrangement.get_active_window()
            index = w.get_pane_index(arrangement_pane)
        except ValueError:
            index = '/'

        return '%3s ' % index

    def on_click():
        " Click handler for the clock. When clicked, select this pane. "
        arrangement_pane.clock_mode = False
        pymux.arrangement.get_active_window().active_pane = arrangement_pane
        pymux.invalidate()


    return HighlightBordersIfActive(
        window,
        arrangement_pane,
        get_terminal_style,
        FloatContainer(
            HSplit([
                # The terminal.
                TracePaneWritePosition(
                    pymux, arrangement_pane,
                    content=arrangement_pane.terminal),
            ]),

            #
            floats=[
                # The title bar.
                Float(content=
                    ConditionalContainer(
                        content=VSplit([
                                Window(
                                    height=1,
                                    content=FormattedTextControl(
                                        get_titlebar_text_fragments)),
                                Window(
                                    height=1,
                                    width=4,
                                    content=FormattedTextControl(get_pane_index),
                                    style='class:paneindex')
                            ], style='class:titlebar'),
                        filter=Condition(lambda: pymux.enable_pane_status)),
                    left=0, right=0, top=-1, height=1, z_index=Z_INDEX.WINDOW_TITLE_BAR),

                # The clock.
                Float(
                    content=ConditionalContainer(BigClock(on_click),
                      filter=clock_is_visible)),

                # Pane number.
                Float(content=ConditionalContainer(
                      content=PaneNumber(pymux, arrangement_pane),
                      filter=pane_numbers_are_visible)),
            ]
        )
    )
Create a `Container` with a titlebar for a process.