Does Python Allow Nested Functions In R