<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_polyline(self, path=None, **kwargs):
 """ Adds a polyline dict to the Map.polylines attribute The Google Maps API describes a polyline as a "linear overlay of connected line segments on the map". The linear paths are defined by a list of Latitude and Longitude coordinate pairs, like so: { 'lat': y, 'lng': x } with each one being a point of the polyline path. It accepts a polyline dict representation as well. Args: path (list(dict)):
 The set of points of the path .. _Polyline: https://developers.google.com/maps/documen tation/javascript/reference#Polyline """


        if path:
            if not isinstance(path, list):
                raise AttributeError('The path is a list of dictionary of'
                                     'latitude and longitudes por path points')
            for i, point in enumerate(path):
                if not isinstance(point, dict):
                    if isinstance(point, (list, tuple)) and len(point) == 2:
                        path[i] = {'lat': point[0], 'lng': point[1]}
                    else:
                        raise AttributeError(
                            'All points in the path must be dicts'
                            ' of latitudes and longitudes, list or tuple'
                        )
            kwargs['path'] = path

        kwargs.setdefault('stroke_color', '#FF0000')
        kwargs.setdefault('stroke_opacity', .8)
        kwargs.setdefault('stroke_weight', 2)

        self.polylines.append(kwargs)