The bytes() function returns a bytes object. It is used to convert objects into bytes objects, or create empty bytes object of the specified size.