def _exception_to_dict(exception):
    """Convert exception to an error object to be sent as response to APIs."""
    return {"error": {"type": type(exception).__name__,
                      "message": exception}}