Implemented wrap() in the Python backend