def _wrap_results(result, dtype):
 if is_datetime64_dtype(dtype):
  if (not isinstance(result, np.ndarray)):
   result = lib.Timestamp(result)
  else:
   result = result.view(dtype)
 elif is_timedelta64_dtype(dtype):
  if (not isinstance(result, np.ndarray)):
   if (np.fabs(result) > _int64_max):
    raise ValueError('overflow in timedelta operation')
   result = lib.Timedelta(result, unit='ns')
  else:
   result = result.astype('i8').view(dtype)
 return result

def _wrap_results ( result , dtype ) : if is_datetime64_dtype ( dtype ) : if ( not isinstance ( result , np . ndarray ) ) : result = lib . Timestamp ( result ) else : result = result . view ( dtype ) elif is_timedelta64_dtype ( dtype ) : if ( not isinstance ( result , np . ndarray ) ) : if ( np . fabs ( result ) > _int64_max ) : raise ValueError ( 'overflow in timedelta operation' ) result = lib . Timedelta ( result , unit = 'ns' ) else : result = result . astype ( 'i8' ) . view ( dtype ) return result
wrap our results if needed .