python reversed function time complexity