docstr: If the user has provided a unit in the query, convert it into the column unit, if present.
docstr_tok: ["If","the","user","has","provided","a","unit","in","the","query",",","convert","it","into","the","column","unit",",","if","present","."]
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).magnitude
  
imports: from datasette import hookimpl
  from datasette.views.base import DatasetteError
  from datasette.utils.asgi import BadRequest
  import json
  import numbers
  from .utils import detect_json1, escape_sqlite, path_with_removed_args
label_desc: Use image node_id 6 for calling the Filters obj's underlying member method code with example usage: obj.convert_unit(column, value) and returns: value, value, value