def key_type_n(index):
 def transform_function(key):
  id_or_name = _key_id_or_name_n(key, index)
  if (id_or_name is None):
   return ''
  if isinstance(id_or_name, basestring):
   return KEY_TYPE_NAME
  return KEY_TYPE_ID
 return transform_function

def key_type_n ( index ) : def transform_function ( key ) : id_or_name = _key_id_or_name_n ( key , index ) if ( id_or_name is None ) : return '' if isinstance ( id_or_name , basestring ) : return KEY_TYPE_NAME return KEY_TYPE_ID return transform_function
pull out the nth key type from a key which has parents .