def EntityGroupName(entity):
 element = entity.path().element(0)
 if element.has_id():
  return str(element.id())
 elif element.has_name():
  return element.name()
 else:
  return 'None'

def EntityGroupName ( entity ) : element = entity . path ( ) . element ( 0 ) if element . has_id ( ) : return str ( element . id ( ) ) elif element . has_name ( ) : return element . name ( ) else : return 'None'
given entity primary key as reference proto .