<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def to_dataframe(self, columns=None):
 """Convert a multi-dim to a pandas dataframe."""

    if not isinstance(self.measured_value, DimensionedMeasuredValue):
      raise TypeError(
        'Only a dimensioned measurement can be converted to a DataFrame')

    if columns is None:
      columns = [d.name for d in self.dimensions]
      columns += [self.units.name if self.units else 'value']

    dataframe = self.measured_value.to_dataframe(columns)

    return dataframe