Abort the current request with a 501 (Not Implemented) response code.
    Sets the ``Allow`` response header to the return value of the
    :func:`Resource.get_allowed_methods` function.

    :param instance: Resource instance (used to access the response)
    :type instance: :class:`webob.resource.Resource`
    :raises: :class:`webob.exceptions.ResponseException` of status 501

def raise_501(instance):
    """Abort the current request with a 501 (Not Implemented) response code.
    Sets the ``Allow`` response header to the return value of the
    :func:`Resource.get_allowed_methods` function.

    :param instance: Resource instance (used to access the response)
    :type instance: :class:`webob.resource.Resource`
    :raises: :class:`webob.exceptions.ResponseException` of status 501
    """
    instance.response.status = 501
    instance.response.headers['Allow'] = instance.get_allowed_methods()
    raise ResponseException(instance.response)