def get_key_and_run_from_path(results_path):
    """
    results_path is assumed to be of the form "path/timestamp_key_i_run_j.db".
    This function returns i and j as s tuple (i,j)
    :param results_path:
    :return: (str, str)
    """
    start_of_key = results_path.find("key")
    start_of_run = results_path.find("run")

    key_str = results_path[(start_of_key + 4):(start_of_run - 1)]
    run_str = results_path[(start_of_run + 4):]

    # strip of possible filetype from run
    run_str = run_str.split('.')[0]

    return key_str, run_str