<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def clear_layout(layout):
 """Clear layout content. :param layout: A layout. :type layout: QLayout """

    # Different platform has different treatment
    # If InaSAFE running on Windows or Linux

    # Adapted from http://stackoverflow.com/a/9383780
    if layout is not None:
        while layout.count():
            item = layout.takeAt(0)
            widget = item.widget()
            if widget is not None:
                # Remove the widget from layout
                widget.close()
                widget.deleteLater()
            else:
                clear_layout(item.layout())

            # Remove the item from layout
            layout.removeItem(item)
            del item