code: def invite_by_email(self, email, user, organization, **kwargs):
          # type: (Text, AbstractUser, AbstractBaseOrganization) -> OrganizationInvitationBase
          
          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
docs: 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