def remove_if_exists(filename):
    """ Remove file.

    This is like :func:`os.remove` (or :func:`os.unlink`), except that no
    error is raised if the file does not exist.

    """
    try:
        os.unlink(filename)
    except OSError as ex:
        if ex.errno != errno.ENOENT:
            raise
Remove file.

    This is like :func:`os.remove` (or :func:`os.unlink`), except that no
    error is raised if the file does not exist.