<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def documentation_404(self, base_url=None):
 """Returns a smart 404 page that contains documentation for the written API"""

        base_url = self.base_url if base_url is None else base_url

        def handle_404(request, response, *args, **kwargs):
            url_prefix = request.forwarded_uri[:-1]
            if request.path and request.path != "/":
                url_prefix = request.forwarded_uri.split(request.path)[0]

            to_return = OrderedDict()
            to_return['404'] = ("The API call you tried to make was not defined. "
                                "Here's a definition of the API to help you get going :)")
            to_return['documentation'] = self.documentation(base_url, self.determine_version(request, False),
                                                            prefix=url_prefix)

            if self.output_format == hug.output_format.json:
                response.data = hug.output_format.json(to_return, indent=4, separators=(',', ': '))
                response.content_type = 'application/json; charset=utf-8'
            else:
                response.data = self.output_format(to_return, request=request, response=response)
                response.content_type = self.output_format.content_type

            response.status = falcon.HTTP_NOT_FOUND

        handle_404.interface = True
        return handle_404