Python Access Nested Function In R