def ban(self, request, pk=None): profile = self.get_user(request, pk) allow_see_ban_details(request.user, profile) ban = get_user_ban(profile) if ban: return Response(BanDetailsSerializer(ban).data) else: return Response({})