def build_rectangles(self, rectangles):
if not rectangles:<EOL><INDENT>return<EOL><DEDENT>if not isinstance(rectangles, list):<EOL><INDENT>raise AttributeError('<STR_LIT>')<EOL><DEDENT>for rect in rectangles:<EOL><INDENT>if isinstance(rect, (list, tuple)):<EOL><INDENT>if len(rect) not in (<NUM_LIT:2>, <NUM_LIT:4>):<EOL><INDENT>raise AttributeError('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>if len(rect) == <NUM_LIT:4>:<EOL><INDENT>rect_dict = self.build_rectangle_dict(*rect)<EOL>self.add_rectangle(**rect_dict)<EOL><DEDENT>elif len(rect) == <NUM_LIT:2>:<EOL><INDENT>if len(rect[<NUM_LIT:0>]) != <NUM_LIT:2> or len(rect[<NUM_LIT:1>]) != <NUM_LIT:2>:<EOL><INDENT>raise AttributeError('<STR_LIT>')<EOL><DEDENT>rect_dict = self.build_rectangle_dict(rect[<NUM_LIT:0>][<NUM_LIT:0>],<EOL>rect[<NUM_LIT:0>][<NUM_LIT:1>],<EOL>rect[<NUM_LIT:1>][<NUM_LIT:0>],<EOL>rect[<NUM_LIT:1>][<NUM_LIT:1>])<EOL>self.add_rectangle(**rect_dict)<EOL><DEDENT>else:<EOL><INDENT>raise AttributeError('<STR_LIT>')<EOL><DEDENT><DEDENT>elif isinstance(rect, dict):<EOL><INDENT>self.add_rectangle(**rect)<EOL><DEDENT><DEDENT>
Process data to construct rectangles

        This method is built from the assumption that the rectangles parameter
        is a list of:
            lists :a list with 4 elements indicating [north, west, south, east]
            tuples:a tuple with 4 elements indicating (north, west, south,east)
            tuple of tuples: a tuple of 2 tuple elements of length 2 indicating
            (north_west, south_east)
            dicts: a dictionary with rectangle attributes

        So, for instance, we have this general scenario as a input parameter:
            [[22.345,45.44,23.345, 45.55],
             (22.345,45.44,23.345,45.55),
             ((22.345,45.44),(23.345,45.55)),
             [(22.345,45.44),(23.345,45.55)],
             {
            'stroke_color': stroke_color,
            'stroke_opacity': stroke_opacity,
            'stroke_weight': stroke_weight,
            'fill_color': fill_color,
            'fill_opacity': fill_opacity,
            'bounds': {'north': north,
                       'east': east,
                       'south': south,
                       'west': west,
                       }
            }]