def _id_or_key(list_item):
 if isinstance(list_item, dict):
  if ('id' in list_item):
   return list_item['id']
  if ('key' in list_item):
   return list_item['key']
 return list_item

def _id_or_key ( list_item ) : if isinstance ( list_item , dict ) : if ( 'id' in list_item ) : return list_item [ 'id' ] if ( 'key' in list_item ) : return list_item [ 'key' ] return list_item
return the value at key id or key .