def METHOD_NAME(self, session, ts_min, ts_max , entities = []):
    # DBClass, aggegate and finalformat functions according to DataType
    #Mutable list entities used as default argument to a method or function
    ret = session.query(self.aggregate_func(self.dataClass.value))\
            .filter_by(indicator_id = self.id)
    # Selected entities filter, else all entities are included
    if entities:
        ret = ret.filter(self.dataClass.entity_id.in_(entities))
    # Timestamp range filter
    ret = ret.filter(self.dataClass.timestamp.between(ts_min, ts_max))
    result = ret.scalar()
    return self.format_func(result) if result is not None else None