def get_block_type(values, dtype=None):
dtype = dtype or values.dtype<EOL>vtype = dtype.type<EOL>if is_sparse(dtype):<EOL><INDENT>cls = ExtensionBlock<EOL><DEDENT>elif is_categorical(values):<EOL><INDENT>cls = CategoricalBlock<EOL><DEDENT>elif issubclass(vtype, np.datetime64):<EOL><INDENT>assert not is_datetime64tz_dtype(values)<EOL>cls = DatetimeBlock<EOL><DEDENT>elif is_datetime64tz_dtype(values):<EOL><INDENT>cls = DatetimeTZBlock<EOL><DEDENT>elif is_interval_dtype(dtype) or is_period_dtype(dtype):<EOL><INDENT>cls = ObjectValuesExtensionBlock<EOL><DEDENT>elif is_extension_array_dtype(values):<EOL><INDENT>cls = ExtensionBlock<EOL><DEDENT>elif issubclass(vtype, np.floating):<EOL><INDENT>cls = FloatBlock<EOL><DEDENT>elif issubclass(vtype, np.timedelta64):<EOL><INDENT>assert issubclass(vtype, np.integer)<EOL>cls = TimeDeltaBlock<EOL><DEDENT>elif issubclass(vtype, np.complexfloating):<EOL><INDENT>cls = ComplexBlock<EOL><DEDENT>elif issubclass(vtype, np.integer):<EOL><INDENT>cls = IntBlock<EOL><DEDENT>elif dtype == np.bool_:<EOL><INDENT>cls = BoolBlock<EOL><DEDENT>else:<EOL><INDENT>cls = ObjectBlock<EOL><DEDENT>return cls<EOL>
Find the appropriate Block subclass to use for the given values and dtype.

Parameters
----------
values : ndarray-like
dtype : numpy or pandas dtype

Returns
-------
cls : class, subclass of Block