#NEWLINE# def combined_bbox( layers ) : #NEWLINE# #INDENT# '\n    Returns a bounding box for ``layers`` or None if this is not possible.\n    ' #NEWLINE# bboxes = [ layer . bbox for layer in layers if ( ( layer . bbox is not None ) and ( layer . bbox . width > 0 ) and ( layer . bbox . height > 0 ) ) ] #NEWLINE# if ( not bboxes ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# ( lefts , tops , rights , bottoms ) = zip ( * bboxes ) #NEWLINE# return BBox ( min ( lefts ) , min ( tops ) , max ( rights ) , max ( bottoms ) )