@classmethod
def validate(cls, obj, raise_errors=False):
    """Validate an object to check if it could be of this type.

        Args:
            obj (object): Object to validate.
            raise_errors (bool, optional): If True, errors will be raised when
                the object fails to be validated. Defaults to False.

        Returns:
            bool: True if the object could be of this type, False otherwise.

        """
    if not cls.python_types:
        raise NotImplementedError("Attribute 'python_types' must be set.")
    out = isinstance(obj, cls.python_types)
    if not out and raise_errors:
        raise ValueError(("Object of type '%s' is not one of the accepted " +
            'Python types (%s) for this type (%s).') % (type(obj), cls.
            python_types, cls.name))
    return out
