code: def legend(self, title=None, scale='color', text_color=None):
          
  
          self.legends.append(Legend(title=title, fill=scale, offset=0,
                                     properties=LegendProperties()))
          if text_color:
              color_props = PropertySet(fill=ValueRef(value=text_color))
              self.legends[0].properties.labels = color_props
              self.legends[0].properties.title = color_props
          return self
docs: Convience method for adding a legend to the figure.
  
          Important: This defaults to the color scale that is generated with
          Line, Area, Stacked Line, etc charts. For bar charts, the scale ref is
          usually 'y'.
  
          Parameters
          ----------
          title: string, default None
              Legend Title
          scale: string, default 'color'
              Scale reference for legend
          text_color: str, default None
              Title and label color