docs: def get_dimension_by_unit_id(unit_id, do_accept_unit_id_none=False, **kwargs):
      """
          Return the physical dimension a given unit id refers to.
          if do_accept_unit_id_none is False, it raises an exception if unit_id is not valid or None
          if do_accept_unit_id_none is True, and unit_id is None, the function returns a Dimension with id None (unit_id can be none in some cases)
      """
      if do_accept_unit_id_none == True and unit_id is None:
          # In this special case, the method returns a dimension with id None
          return get_empty_dimension()
  
      try:
          dimension = db.DBSession.query(Dimension).join(Unit).filter(Unit.id==unit_id).filter().one()
          return get_dimension(dimension.id)
      except NoResultFound:
          # The dimension does not exist
          raise ResourceNotFoundError("Unit %s not found"%(unit_id))