def _type_priority(ifo, ftype, trend=None):
<EOL>for trendname, trend_regex in [<EOL>('<STR_LIT>', MINUTE_TREND_TYPE),<EOL>('<STR_LIT>', SECOND_TREND_TYPE),<EOL>]:<EOL><INDENT>if trend == trendname and trend_regex.match(ftype):<EOL><INDENT>return <NUM_LIT:0>, len(ftype)<EOL><DEDENT><DEDENT>for reg, prio in {<EOL>HIGH_PRIORITY_TYPE: <NUM_LIT:1>,<EOL>re.compile(r'<STR_LIT>'): <NUM_LIT:6>,<EOL>LOW_PRIORITY_TYPE: <NUM_LIT:10>,<EOL>MINUTE_TREND_TYPE: <NUM_LIT:10>,<EOL>SECOND_TREND_TYPE: <NUM_LIT:10>,<EOL>}.items():<EOL><INDENT>if reg.search(ftype):<EOL><INDENT>return prio, len(ftype)<EOL><DEDENT><DEDENT>return <NUM_LIT:5>, len(ftype)<EOL>
Prioritise the given GWF type based on its name or trend status.

    This is essentially an ad-hoc ordering function based on internal knowledge
    of how LIGO does GWF type naming.