parameters: (cls, unknown)
docstring: Ensures that the unknown instance is converted to the correct array class.
docstring_summary: Ensures that the unknown instance is converted to the correct array class.
docstring_tokens: Ensures that the unknown instance is converted to the correct array class .
function: def ensure(cls, unknown):
          '''Ensures that the unknown instance is converted to the correct array class.'''
          if isinstance(unknown, cls):
              return unknown
          if isinstance(unknown, np.ndarray):
              return cls(unknown)
          raise ValueError('Cannot convert object of type %s to %s' % (type(unknown).__name__, cls.__name__))
function_tokens: def ensure ( cls , unknown ) : if isinstance ( unknown , cls ) : return unknown if isinstance ( unknown , np . ndarray ) : return cls ( unknown ) raise ValueError ( 'Cannot convert object of type %s to %s' % ( type ( unknown ) . __name__ , cls . __name__ ) )