<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def invite_by_email(self, email, user, organization, **kwargs):
 # type: (Text, AbstractUser, AbstractBaseOrganization) -> OrganizationInvitationBase """ Primary interface method by which one user invites another to join Args: email: request: **kwargs: Returns: an invitation instance Raises: MultipleObjectsReturned if multiple matching users are found """

        try:
            invitee = self.user_model.objects.get(email__iexact=email)
        except self.user_model.DoesNotExist:
            invitee = None

        # TODO allow sending just the OrganizationUser instance
        user_invitation = self.invitation_model.objects.create(
            invitee=invitee,
            invitee_identifier=email.lower(),
            invited_by=user,
            organization=organization,
        )
        self.send_invitation(user_invitation)
        return user_invitation