def normalize(a, axis=None):
 a_sum = a.sum(axis)
 if (axis and (a.ndim > 1)):
  a_sum[(a_sum == 0)] = 1
  shape = list(a.shape)
  shape[axis] = 1
  a_sum.shape = shape
 a /= a_sum

def normalize ( a , axis = None ) : a_sum = a . sum ( axis ) if ( axis and ( a . ndim > 1 ) ) : a_sum [ ( a_sum == 0 ) ] = 1 shape = list ( a . shape ) shape [ axis ] = 1 a_sum . shape = shape a /= a_sum
normalize a string so that it can be used as an attribute to a python object .