def METHOD_NAME(log, start_time, end_time):
    """If query doesn't contain problem statements, saves it."""
    problem_keywords = [
        "INTERNAL QUERY */",
        "DEALLOCATE pdo_stmt_",
        "UNLISTEN *",
        "context: SQL",
        "ERROR:",
        "CONTEXT:  SQL",
        "show ",
        "Undoing transaction",
        "Undo on",
        "pg_terminate_backend",
        "pg_cancel_backend",
        "volt_",
        "pg_temp_",
    ]
    potential_problem_keywords = [
        "BIND"
    ]
    not_problem_keywords = [
        "BINDING"
    ]
    if log.username == "rdsdb":
        return False
    if start_time and log.record_time < start_time:
        return False
    if end_time and log.record_time > end_time:
        return False
    if any(word in log.text for word in problem_keywords):
        return False
    if any(word in log.text for word in potential_problem_keywords) and not any(word in log.text for word in not_problem_keywords):
        return False
    # filter internal statement rewrites with parameter markers
    if re.search('\$\d',log.text):
        # remove \$\d in string literals ( select '$1' ) or comment blocks ( */ $1 */ )
        text_without_valid_parameter_markers = re.sub("""'.*\\$\\d.*'|\\/\\*.*\\$\\d.*\\*\\/""",'',log.text,flags=re.DOTALL)
        # remove \$\d in single line quotes ( -- $1 )
        if '--' in log.text:
            text_without_valid_parameter_markers = re.sub('^\s*--.*\$\d','',text_without_valid_parameter_markers)
        # if there are still parameter markers remaining after removing them from valid cases, the query text is invalid
        if re.search('\$\d',text_without_valid_parameter_markers):
            return False
    return True