def EntityKind(key):
  if key.path().element_list():
    return key.path().element_list()[-1].type()
  else:
    return ''
Given entity primary key as Reference Proto, returns entity kind.
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/ext/analytics/entity.py/EntityKind