docs: def check_attr_dimension(attr_id, **kwargs):
      """
          Check that the dimension of the resource attribute data is consistent
          with the definition of the attribute.
          If the attribute says 'volume', make sure every dataset connected
          with this attribute via a resource attribute also has a dimension
          of 'volume'.
      """
      attr_i = _get_attr(attr_id)
  
      datasets = db.DBSession.query(Dataset).filter(Dataset.id == ResourceScenario.dataset_id,
                          ResourceScenario.resource_attr_id == ResourceAttr.id,
                          ResourceAttr.attr_id == attr_id).all()
      bad_datasets = []
      for d in datasets:
          if  attr_i.dimension_id is None and d.unit is not None or \
              attr_i.dimension_id is not None and d.unit is None or \
              units.get_dimension_by_unit_id(d.unit_id) != attr_i.dimension_id:
                  # If there is an inconsistency
                  bad_datasets.append(d.id)
  
      if len(bad_datasets) > 0:
          raise HydraError("Datasets %s have a different dimension_id to attribute %s"%(bad_datasets, attr_id))
  
      return 'OK'