Add __name__ == '__main__' check in example code, making it runnable