def error_of_type(handler: astroid.ExceptHandler, error_type) -> bool:
def stringify_error(error):<EOL><INDENT>if not isinstance(error, str):<EOL><INDENT>return error.__name__<EOL><DEDENT>return error<EOL><DEDENT>if not isinstance(error_type, tuple):<EOL><INDENT>error_type = (error_type,)  <EOL><DEDENT>expected_errors = {stringify_error(error) for error in error_type}  <EOL>if not handler.type:<EOL><INDENT>return True<EOL><DEDENT>return handler.catch(expected_errors)<EOL>
Check if the given exception handler catches
the given error_type.

The *handler* parameter is a node, representing an ExceptHandler node.
The *error_type* can be an exception, such as AttributeError,
the name of an exception, or it can be a tuple of errors.
The function will return True if the handler catches any of the
given errors.