code: def basic_auth_required(view_func):
      
      @wraps(view_func)
      def wrapper(*args, **kwargs):
          if app.config.get('BASIC_AUTH_ACTIVE', False):
              if basic_auth.authenticate():
                  return view_func(*args, **kwargs)
              else:
                  return basic_auth.challenge()
          else:
              return view_func(*args, **kwargs)
      return wrapper
docs: A decorator that can be used to protect specific views with HTTP basic
      access authentication. Conditional on having BASIC_AUTH_USERNAME and
      BASIC_AUTH_PASSWORD set as env vars.