def create_pane(widgets, horizontal, parent_widget=None, compact=False,<EOL>compact_spacing=<NUM_LIT:2>):
pane = parent_widget or QtGui.QWidget()<EOL>type_ = QtGui.QHBoxLayout if horizontal else QtGui.QVBoxLayout<EOL>layout = type_()<EOL>if compact:<EOL><INDENT>layout.setSpacing(compact_spacing)<EOL>layout.setContentsMargins(compact_spacing, compact_spacing,<EOL>compact_spacing, compact_spacing)<EOL><DEDENT>for widget in widgets:<EOL><INDENT>stretch = <NUM_LIT:0><EOL>if isinstance(widget, tuple):<EOL><INDENT>widget, stretch = widget<EOL><DEDENT>if isinstance(widget, int):<EOL><INDENT>layout.addSpacing(widget)<EOL><DEDENT>elif widget:<EOL><INDENT>layout.addWidget(widget, stretch)<EOL><DEDENT>else:<EOL><INDENT>layout.addStretch()<EOL><DEDENT><DEDENT>pane.setLayout(layout)<EOL>return pane<EOL>
Create a widget containing an aligned set of widgets.

    Args:
        widgets (list of `QWidget`).
        horizontal (bool).
        align (str): One of:
            - 'left', 'right' (horizontal);
            - 'top', 'bottom' (vertical)
        parent_widget (`QWidget`): Owner widget, QWidget is created if this
            is not provided.

    Returns:
        `QWidget`