docs: def is_draft(request):
          """
          A request is considered to be in draft mode if:
          - it is for *any* admin resource, since the admin site deals only with
            draft objects and hides the published version from admin users
          - it is for *any* view in *any* app that deals only with draft objects
          - user is a member of the "Content Reviewer" group, since content
            reviewers' sole purpose is to review draft content and they need not
            see the published content
          - the user is a staff member and therefore can see draft versions of
            pages if they wish, and the 'preview' GET parameter flag is included
            to show the draft page is definitely wanted instead of a normal
            published page.
          - the 'preview' GET parameter flag is included with a valid HMAC for
            the requested URL, regardless of authenticated permissions.
          """
          # Admin resource requested.
          if PublishingMiddleware.is_admin_request(request):
              return True
          # API resource requested.
          if PublishingMiddleware.is_api_request(request):
              return True
          # Draft-only view requested.
          if PublishingMiddleware.is_draft_only_view(request):
              return True
          # Content reviewer made request.
          if PublishingMiddleware.is_content_reviewer_user(request):
              return True
          # Draft mode requested.
          if PublishingMiddleware.is_draft_request(request):
              # User is staff.
              if PublishingMiddleware.is_staff_user(request):
                  return True
              # Request contains a valid draft mode HMAC in the querystring.
              if verify_draft_url(request.get_full_path()):
                  return True
          # Not draft mode.
          return False