def get_new_ext(path, ext):
    """Returns the given file path, with the file extension changed to the given extension."""
    if not ext.startswith('.'):
        ext = '.' + ext
    # os.path.splitext did not behave as expected here -> splitting extension off manually.
    index = path.rfind('.')
    asset_path = path[:index]
    asset_path = asset_path + ext
    return asset_path