def _array_to_file_like(arr, fileobj):
 if (len(arr) == 0):
  return
 if arr.flags.contiguous:
  try:
   fileobj.write(arr.data)
  except TypeError:
   pass
  else:
   return
 if hasattr(np, 'nditer'):
  for item in np.nditer(arr):
   fileobj.write(item.tostring())
 else:
  byteorder = arr.dtype.byteorder
  if (((sys.byteorder == 'little') and (byteorder == '>')) or ((sys.byteorder == 'big') and (byteorder == '<'))):
   for item in arr.flat:
    fileobj.write(item.byteswap().tostring())
  else:
   for item in arr.flat:
    fileobj.write(item.tostring())

def _array_to_file_like ( arr , fileobj ) : if ( len ( arr ) == 0 ) : return if arr . flags . contiguous : try : fileobj . write ( arr . data ) except TypeError : pass else : return if hasattr ( np , 'nditer' ) : for item in np . nditer ( arr ) : fileobj . write ( item . tostring ( ) ) else : byteorder = arr . dtype . byteorder if ( ( ( sys . byteorder == 'little' ) and ( byteorder == '>' ) ) or ( ( sys . byteorder == 'big' ) and ( byteorder == '<' ) ) ) : for item in arr . flat : fileobj . write ( item . byteswap ( ) . tostring ( ) ) else : for item in arr . flat : fileobj . write ( item . tostring ( ) )
write a ~numpy .