def find_break_point(line, max_index, key_list):
    """ find the most appropriate break point for a fortran line """
    for key in key_list:
        idx = line.rfind(key, 0, max_index)
        if idx > 0:
            return idx + len(key)
    raise Exception(
        "Error in find_break_point. No suitable break point found for line '" +
        line[:max_index] + "' and keys '" + str(key_list) + "'")
