def extend_path(path, valid_extensions, default_extension):
    """
    Return tuple (path, extension) ensuring that path has extension.

    """
    for extension in valid_extensions:
        if path.endswith("." + extension):
            return (path, extension)
    return (path + "." + default_extension, default_extension)