code: def _maybe_view_as_subclass(original_array, new_array):
      if type(original_array) is not type(new_array):
          # if input was an ndarray subclass and subclasses were OK,
          # then view the result as that subclass.
          new_array = new_array.view(type=type(original_array))
          # Since we have done something akin to a view from original_array, we
          # should let the subclass finalize (if it has it implemented, i.e., is
          # not None).
          if new_array.__array_finalize__:
              new_array.__array_finalize__(original_array)
      return new_array
  
file_path: catboost/contrib/python/matplotlib/py2/matplotlib/cbook/_backports.py
imports: from __future__ import absolute_import
  import os
  import sys
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: _maybe_view_as_subclass(original_array, new_array) and returns: new_array