def ensure_uint255(arr):
 if (arr.dtype == 'uint8'):
  return arr
 elif (arr.dtype in ('float32', 'float64')):
  return np.array((arr * 255), dtype='uint8')
 else:
  raise Exception(('ensure_uint255 expects uint8 or float input but got %s with range [%g,%g,].' % (arr.dtype, arr.min(), arr.max())))

def ensure_uint255 ( arr ) : if ( arr . dtype == 'uint8' ) : return arr elif ( arr . dtype in ( 'float32' , 'float64' ) ) : return np . array ( ( arr * 255 ) , dtype = 'uint8' ) else : raise Exception ( ( 'ensure_uint255 expects uint8 or float input but got %s with range [%g,%g,].' % ( arr . dtype , arr . min ( ) , arr . max ( ) ) ) )
if data is float .