<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def legend(self, values):
 """Set the legend labels. Args: values (list):
 list of labels. Raises: ValueError: legend must be a list of labels. """

        if not isinstance(values, list):
            raise TypeError("legend must be a list of labels")

        self.options["legend"] = values