def enrich_varname(varname):
 greek = 'alpha beta gamma delta epsilon varepsilon zeta eta theta vartheta iota kappa lambda mu nu xi pi rho sigma tau upsilon phi varphi chi psi omega'.split()
 greek += [x.capitalize() for x in greek]
 greek.append('hbar')
 greek.append('infty')
 if (varname in greek):
  return u'\\{letter}'.format(letter=varname)
 else:
  return varname.replace('_', '\\_')

def enrich_varname ( varname ) : greek = 'alpha beta gamma delta epsilon varepsilon zeta eta theta vartheta iota kappa lambda mu nu xi pi rho sigma tau upsilon phi varphi chi psi omega' . split ( ) greek += [ x . capitalize ( ) for x in greek ] greek . append ( 'hbar' ) greek . append ( 'infty' ) if ( varname in greek ) : return u'\\{letter}' . format ( letter = varname ) else : return varname . replace ( '_' , '\\_' )
prepend a backslash if were given a greek character .