def make_meter_query_for_resource(start_timestamp, start_timestamp_op, end_timestamp, end_timestamp_op, source, query=None):
 (start_rts, end_rts) = get_start_end_rts(start_timestamp, end_timestamp)
 mq = []
 start_op = (start_timestamp_op or 'ge')
 end_op = (end_timestamp_op or 'lt')
 if start_rts:
  filter_value = (((start_rts + ':') + quote(source)) if source else start_rts)
  mq.append(_QualifierFilter(OP_SIGN_REV[start_op], filter_value))
 if end_rts:
  filter_value = (((end_rts + ':') + quote(source)) if source else end_rts)
  mq.append(_QualifierFilter(OP_SIGN_REV[end_op], filter_value))
 if mq:
  meter_q = ' AND '.join(mq)
  meter_q = ((_QualifierFilter('=', '') + ' AND ') + meter_q)
  query = (meter_q if (not query) else ((query + ' AND ') + meter_q))
 return query

def make_meter_query_for_resource ( start_timestamp , start_timestamp_op , end_timestamp , end_timestamp_op , source , query = None ) : ( start_rts , end_rts ) = get_start_end_rts ( start_timestamp , end_timestamp ) mq = [ ] start_op = ( start_timestamp_op or 'ge' ) end_op = ( end_timestamp_op or 'lt' ) if start_rts : filter_value = ( ( ( start_rts + ':' ) + quote ( source ) ) if source else start_rts ) mq . append ( _QualifierFilter ( OP_SIGN_REV [ start_op ] , filter_value ) ) if end_rts : filter_value = ( ( ( end_rts + ':' ) + quote ( source ) ) if source else end_rts ) mq . append ( _QualifierFilter ( OP_SIGN_REV [ end_op ] , filter_value ) ) if mq : meter_q = ' AND ' . join ( mq ) meter_q = ( ( _QualifierFilter ( '=' , '' ) + ' AND ' ) + meter_q ) query = ( meter_q if ( not query ) else ( ( query + ' AND ' ) + meter_q ) ) return query
this method is used when resource table should be filtered by meters .