<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def pivot_and_annotate(self, values, gpl, annotation_column, gpl_on="ID", gsm_on="ID_REF"):
 """Annotate GSM with provided GPL. Args: values (:obj:`str`):
 Column to use as values eg. "VALUES" gpl (:obj:`pandas.DataFrame` or :obj:`GEOparse.GPL`):
 A Platform or DataFrame to annotate with. annotation_column (:obj:`str`):
 Column in table for annotation. gpl_on (:obj:`str`, optional):
 Use this column in GPL to merge. Defaults to "ID". gsm_on (:obj:`str`, optional):
 Use this column in GSM to merge. Defaults to "ID_REF". Returns: pandas.DataFrame: Pivoted and annotated table of results """

        if isinstance(gpl, GPL):
            annotation_table = gpl.table
        elif isinstance(gpl, DataFrame):
            annotation_table = gpl
        else:
            raise TypeError("gpl should be a GPL object or a pandas.DataFrame")
        pivoted_samples = self.pivot_samples(values=values, index=gsm_on)
        ndf = pivoted_samples.reset_index().merge(
            annotation_table[[gpl_on, annotation_column]],
            left_on=gsm_on,
            right_on=gpl_on).set_index(gsm_on)
        del ndf[gpl_on]
        ndf.columns.name = 'name'
        return ndf