Upper And Lower Functions In Python