def METHOD_NAME(query):
    """
    Do a query against the run table with time constraints.
    """
    def absrel_arg(arg):
        value = arg_string(arg)
        if value is not None:
            value = pscheduler.iso8601_absrel(value)
        return value
    start = absrel_arg("start")
    end = absrel_arg("end")
    # Autocorrect upside down ranges.
    if (start is not None) and (end is not None) and (start > end):
        (start, end) = (end, start)
    if start is not None:
        query += " AND lower(times) >= '%s'" % (str(start))
    if end is not None:
        query += " AND lower(times) <= '%s'" % (str(end))
    return single_numeric_query(query)