How to convert functions into transformer?

I have learned about in Scikit-learn, I can easily integrate custom data preprocessing or feature engineering steps into their machine learning pipelines by converting functions into transformers. I’m a beginner and don’t know much about transformers. I have tried to code it but didn’t succeed. Can someone correct my code?

from sklearn.datasets import load_iris
from sklearn.preprocessing import FunctionTransformer
import numpy as np
iris = load_iris() #loading dataset
# converting using numpy log function
log_transformer = FunctionTransformer(np.log)
iris_log = transform(
# printing only first 5 rows
for i in range(5):

NameError: name 'transform' is not defined

I have learned that many kinds of Transformers are available in it. Can someone explain them with code examples to me?