'Extends :meth:`flask_restplus.Api.response` to allow passing an :class:`ApiError` class instead of
response code. If an `ApiError` is used, the response code, and expected response model, is automatically
documented.'

def response(self, code_or_apierror, description=u'Success', model=None, **kwargs):

    try:
        if issubclass(code_or_apierror, APIError):
            description = (code_or_apierror.description or description)
            return self.doc(responses={code_or_apierror.status_code: (description, code_or_apierror.response_model)}, **kwargs)
    except TypeError:
        pass
    return self.doc(responses={code_or_apierror: (description, model)}, **kwargs)
