def _preferred_alias(aliases):
 if (not aliases):
  return
 aliases = [a for a in aliases if ('locale' in a)]
 for locale in config['import']['languages'].as_str_seq():
  matches = [a for a in aliases if ((a['locale'] == locale) and ('primary' in a))]
  if (not matches):
   continue
  return matches[0]

def _preferred_alias ( aliases ) : if ( not aliases ) : return aliases = [ a for a in aliases if ( 'locale' in a ) ] for locale in config [ 'import' ] [ 'languages' ] . as_str_seq ( ) : matches = [ a for a in aliases if ( ( a [ 'locale' ] == locale ) and ( 'primary' in a ) ) ] if ( not matches ) : continue return matches [ 0 ]
given an list of alias structures for an artist credit .