def invite_by_emails(self, emails):
assert emails is None or isinstance(emails, list)<EOL>results = []<EOL>for email in emails:<EOL><INDENT>try:<EOL><INDENT>user = User.query.filter_by(email=email).one()<EOL>results.append(self.invite(user))<EOL><DEDENT>except NoResultFound:<EOL><INDENT>results.append(None)<EOL><DEDENT><DEDENT>return results<EOL>
Invite users to a group by emails.

        :param list emails: Emails of users that shall be invited.
        :returns list: Newly created Memberships or Nones.