def get_metric(name):
 try:
  return globals()[name]
 except:
  raise ValueError('Invalid metric function.')

def get_metric ( name ) : try : return globals ( ) [ name ] except : raise ValueError ( 'Invalid metric function.' )
return the current value for the named metric .