Python Dictionary Length Function In R