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: import ast
  import re
  import sys
  import warnings
  from ..exceptions import DTypePromotionError
  from .multiarray import dtype, array, ndarray, promote_types
label_desc: Use image node_id 10 for calling a global function with example usage: _view_is_safe(oldtype, newtype) without return types