title: Decorate a function if condition is True?
body: <p>I want to do something akin to this, which (understandably) results in a SyntaxError:</p>
  
  <pre><code>@api_view(['GET'])
  if settings.USE_API_KEY:
      @authentication_classes((TokenAuthentication, ))
      @permission_classes((IsAuthenticated, ))
  def all_announcements(request):
      announcements = Announcement.objects.all()
      serializer = AnnouncementSerializer(announcements, many=True)
      return Response(serializer.data)
  </code></pre>
  
  <p>How can I implement something similiar to this?</p>