def _is_dtype(arr_or_dtype, condition):
if arr_or_dtype is None:<EOL><INDENT>return False<EOL><DEDENT>try:<EOL><INDENT>dtype = _get_dtype(arr_or_dtype)<EOL><DEDENT>except (TypeError, ValueError, UnicodeEncodeError):<EOL><INDENT>return False<EOL><DEDENT>return condition(dtype)<EOL>
Return a boolean if the condition is satisfied for the arr_or_dtype.

Parameters
----------
arr_or_dtype : array-like, str, np.dtype, or ExtensionArrayType
    The array-like or dtype object whose dtype we want to extract.
condition : callable[Union[np.dtype, ExtensionDtype]]

Returns
-------
bool