docs: def validate_attr(resource_attr_id, scenario_id, template_id=None):
      """
          Check that a resource attribute satisfies the requirements of all the types of the
          resource.
      """
      rs = db.DBSession.query(ResourceScenario).\
                          filter(ResourceScenario.resource_attr_id==resource_attr_id,
          ResourceScenario.scenario_id==scenario_id).options(
          joinedload_all("resourceattr")).options(
          joinedload_all("dataset")
          ).one()
  
      error = None
  
      try:
          _do_validate_resourcescenario(rs, template_id)
      except HydraError as e:
  
          error = JSONObject(dict(
                   ref_key = rs.resourceattr.ref_key,
                   ref_id  = rs.resourceattr.get_resource_id(),
                   ref_name = rs.resourceattr.get_resource().get_name(),
                   resource_attr_id = rs.resource_attr_id,
                   attr_id          = rs.resourceattr.attr.id,
                   attr_name        = rs.resourceattr.attr.name,
                   dataset_id       = rs.dataset_id,
                   scenario_id=scenario_id,
                   template_id=template_id,
                   error_text=e.args[0]))
      return error