module 'tensorrt' has no attribute 'utils'

Ubuntu 16.04 LTS
GPU type:1050Ti
nvidia driver version:390.87
CUDA version:9.0
CUDNN version:7.13
Python version:3.5
TensorRT version: 5.0

When calling ‘tensorrt.utils.write_engine_to_file’,the error occur: module ‘tensorrt’ has no attribute ‘utils’

write_engine_to_file is in tensorrt.legacy.utils now