def change_extension(filename, extension):
    """Change file extenstion to @extension.

    >>> change_extension('file_name.py', 'html')
    'file_name.html'
    >>> change_extension('file_name.with.dots.html', 'py')
    'file_name.with.dots.py'
    """
    return '.'.join(filename.split('.')[:-1] + [extension])