<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _validate_error(error):
 """Validate and return the given error object. Based on the given error object, return either None or a dict with a "message" key whose value is a string (the dict may also have any other keys that it wants). The given "error" object can be: - None, in which case None is returned - A string, in which case a dict like this will be returned: {"message": error_string} - A dict with a "message" key whose value is a string, in which case the dict will be returned unchanged :param error: the error object to validate :raises InvalidErrorObjectError: If the error object doesn't match any of the allowed types """

    if error is None:
        return None
    elif isinstance(error, basestring):
        return {"message": error}
    else:
        try:
            message = error["message"]
            if isinstance(message, basestring):
                return error
            else:
                raise InvalidErrorObjectError(
                    "error['message'] must be a string")
        except (TypeError, KeyError):
            raise InvalidErrorObjectError(
                "error must be either a string or a dict with a message key")