check for dict type in case object implements get
use getattr only if object doesn't have __getitem__
use ternary
Merge branch 'extend_dicttoolz'