#NEWLINE# @ classmethod #NEWLINE# @ lru_cache ( maxsize = ENTITY_CACHE_SIZE ) #NEWLINE# def get_entity( cls , kind , literal ) : #NEWLINE# #INDENT# kw = { #NEWLINE# #INDENT# 'key' : literal , #NEWLINE# #UNINDENT# } #NEWLINE# if isinstance ( kind , int ) : #NEWLINE# #INDENT# kw [ 'kind_id' ] = kind #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# kw [ 'kind__name' ] = kind #NEWLINE# #UNINDENT# return Entity . objects . get ( ** kw )