Small wrapper function to returns an instance of :class:`Application`
    which serves the objects in the defs. Usually this is called with return
    value globals() from the module where the resources are defined. The
    returned WSGI application will serve all subclasses of
    :class:`wsgiservice.Resource` found in the dictionary.

    :param defs: Each :class:`wsgiservice.Resource` object found in the values
                 of this dictionary is used as application resource. The other
                 values are discarded.
    :type defs: dict
    :param add_help: Whether to add the Help resource which will expose the
                     documentation of this service at /_internal/help
    :type add_help: boolean
    :rtype: :class:`Application`

def get_app(defs, add_help=True):
    """Small wrapper function to returns an instance of :class:`Application`
    which serves the objects in the defs. Usually this is called with return
    value globals() from the module where the resources are defined. The
    returned WSGI application will serve all subclasses of
    :class:`wsgiservice.Resource` found in the dictionary.

    :param defs: Each :class:`wsgiservice.Resource` object found in the values
                 of this dictionary is used as application resource. The other
                 values are discarded.
    :type defs: dict
    :param add_help: Whether to add the Help resource which will expose the
                     documentation of this service at /_internal/help
    :type add_help: boolean
    :rtype: :class:`Application`
    """
    def is_resource(d):
        try:
            if issubclass(d, wsgiservice.Resource) and hasattr(d, '_path'):
                return True
        except TypeError:
            pass  # d wasn't a class

        return False

    resources = [d for d in defs.values() if is_resource(d)]
    if add_help:
        resources.append(wsgiservice.resource.Help)
    return Application(resources)