human
Complete this python program:
def http_basic_auth(login_cb=(lambda username, password: False)):
assistant
#Here is the Python program you requested.

    """A crude decorator to force a handler to request HTTP Basic Authentication
    Example usage:
    .. code-block:: python
    @http_basic_auth(lambda u, p: u == \foo\ and p == \bar\)
    class AuthenticatedHandler(tornado.web.RequestHandler):
    pass
    """
    def wrapper(handler_class):
        def wrap_execute(handler_execute):
            def check_auth(handler, kwargs):
                auth = handler.request.headers.get('Authorization')
                if ((auth is None) or (not auth.startswith('Basic    '))):
                    handler.set_status(401)
                    handler.set_header('WWW-Authenticate', 'Basic    realm=Restricted')
                else:
                    (username, password) = base64.b64decode(auth[6:]).split(':', 1)
                    if login_cb(username, password):
                        return
                    else:
                        handler.set_status(403)
                handler._transforms = []
                handler.finish()
            def _execute(self, transforms, *args, **kwargs):
                check_auth(self, kwargs)
                return handler_execute(self, transforms, *args, **kwargs)
            return _execute
        handler_class._execute = wrap_execute(handler_class._execute)
        return handler_class
    return wrapper