def expand_abbreviations(template, abbreviations):
 if (template in abbreviations):
  return abbreviations[template]
 (prefix, sep, rest) = template.partition(u':')
 if (prefix in abbreviations):
  return abbreviations[prefix].format(rest)
 return template

def expand_abbreviations ( template , abbreviations ) : if ( template in abbreviations ) : return abbreviations [ template ] ( prefix , sep , rest ) = template . partition ( u':' ) if ( prefix in abbreviations ) : return abbreviations [ prefix ] . format ( rest ) return template
expand abbreviations in a template name .