code: def _view_is_safe(oldtype, newtype):
      """Checks safety of a view involving object arrays, for example when
      doing::
  
          np.zeros(10, dtype=oldtype).view(newtype)
  
      Parameters
      ----------
      oldtype : data-type
          Data type of original ndarray
      newtype : data-type
          Data type of the view
  
      Raises
      ------
      TypeError
          If the new type is incompatible with the old type.
  
      """
  
      # if the types are equivalent, there is no problem.
      # for example: dtype((np.record, 'i4,i4')) == dtype((np.void, 'i4,i4'))
      if oldtype == newtype:
          return
  
      if newtype.hasobject or oldtype.hasobject:
          raise TypeError("Cannot change data-type for object array.")
      return
  
imports: from __future__ import division, absolute_import, print_function
  import re
  import sys
  import platform
  from numpy.compat import unicode
  from numpy.core.overrides import set_module
  from .multiarray import dtype, array, ndarray
label_desc: Use image node_id 10 for calling a global function with example usage: _view_is_safe(oldtype, newtype) without return types