code: def convert_unit(self, column, value):
          "If the user has provided a unit in the query, convert it into the column unit, if present."
          if column not in self.units:
              return value
  
          # Try to interpret the value as a unit
          value = self.ureg(value)
          if isinstance(value, numbers.Number):
              # It's just a bare number, assume it's the column unit
              return value
  
          column_unit = self.ureg(self.units[column])
          return value.to(column_unit).magnitudf convert_unit(self, column, value):
          "If the user has provided a unit in the query, convert it into the column unit, if present."
          if column not in self.units:
              return value
  
          # Try to interpret the value as a unit
          value = self.ureg(value)
          if isinstance(value, numbers.Number):
              # It's just a bare number, assume it's the column unit
              return value
  
          column_unit = self.ureg(self.units[column])
          return value.to(column_unit).magnitude
docs: If the user has provided a unit in the query, convert it into the column unit, if present.