#NEWLINE# def coerce_layout( thing ) : #NEWLINE# #INDENT# ' Coerce a variety of objects into a docklayout.\n\n        Parameters\n        ----------\n        thing : dict, basetring, dockitem, dockarea, split, or tabs\n            Something that can be coerced into a dock layout.\n\n        ' #NEWLINE# if ( thing is None ) : #NEWLINE# #INDENT# return docklayout ( None ) #NEWLINE# #UNINDENT# if isinstance ( thing , basestring ) : #NEWLINE# #INDENT# thing = dockitem ( thing ) #NEWLINE# #UNINDENT# if isinstance ( thing , ( dockitem , docksplit , docktabs ) ) : #NEWLINE# #INDENT# return docklayout ( dockarea ( thing ) ) #NEWLINE# #UNINDENT# if isinstance ( thing , dockarea ) : #NEWLINE# #INDENT# return docklayout ( thing ) #NEWLINE# #UNINDENT# msg = "cannot coerce '%s' to a 'docklayout'" #NEWLINE# raise TypeError ( ( msg % type ( thing ) . __name__ ) )