def METHOD_NAME(self):
    """
    Users should receive the DetailedUserSerializer if they tries to get themselves or have the
    EDIT permission.
    """
    if self.action in ["retrieve", "update", "partial_update"]:
        try:
            instance = self.get_object()
        except AssertionError:
            return PublicUserWithGroupsSerializer
        if (
            self.request.user.has_perm(EDIT, instance)
            or self.request.user == instance
        ):
            return MeSerializer
        return PublicUserWithGroupsSerializer
    elif self.action == "create":
        return RegistrationConfirmationSerializer
    return super().METHOD_NAME()