'Mount an application (:class:`Bottle` or plain WSGI) to a specific
URL prefix. Example::
root_app.mount(\'/admin/\', admin_app)
:param prefix: path prefix or `mount-point`. If it ends in a slash,
that slash is mandatory.
:param app: an instance of :class:`Bottle` or a WSGI application.
All other parameters are passed to the underlying :meth:`route` call.'

def mount(self, prefix, app, **options):

    segments = [p for p in prefix.split('/') if p]
    if (not segments):
        raise ValueError('Empty    path    prefix.')
    path_depth = len(segments)
    def mountpoint_wrapper():
        try:
            request.path_shift(path_depth)
            rs = HTTPResponse([])
            def start_response(status, headerlist, exc_info=None):
                if exc_info:
                    _raise(*exc_info)
                rs.status = status
                for (name, value) in headerlist:
                    rs.add_header(name, value)
                return rs.body.append
            body = app(request.environ, start_response)
            rs.body = (itertools.chain(rs.body, body) if rs.body else body)
            return rs
        finally:
            request.path_shift((- path_depth))
    options.setdefault('skip', True)
    options.setdefault('method', 'PROXY')
    options.setdefault('mountpoint', {'prefix': prefix, 'target': app})
    options['callback'] = mountpoint_wrapper
    self.route(('/%s/<:re:.*>' % '/'.join(segments)), **options)
    if (not prefix.endswith('/')):
        self.route(('/' + '/'.join(segments)), **options)
