<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(self, index, **kwargs):
 """ Pivots a dataframe """

        try:
            df = self._pivot(index, **kwargs)
            return pd.pivot_table(self.df, index=kwargs["index"],  **kwargs)
            """if df is None:
                self.err("Can not pivot table")
                return
            self.df = df"""
        except Exception as e:
            self.err(e, "Can not pivot dataframe")