@classmethod<EOL><INDENT>def create(cls, community, record, user=None, expires_at=None,<EOL>notify=True):<DEDENT>
if expires_at and expires_at < datetime.utcnow():<EOL><INDENT>raise InclusionRequestExpiryTimeError(<EOL>community=community, record=record)<EOL><DEDENT>if community.has_record(record):<EOL><INDENT>raise InclusionRequestObsoleteError(<EOL>community=community, record=record)<EOL><DEDENT>try:<EOL><INDENT>with db.session.begin_nested():<EOL><INDENT>obj = cls(<EOL>id_community=community.id,<EOL>id_record=record.id,<EOL>user=user,<EOL>expires_at=expires_at<EOL>)<EOL>db.session.add(obj)<EOL><DEDENT><DEDENT>except (IntegrityError, FlushError):<EOL><INDENT>raise InclusionRequestExistsError(<EOL>community=community, record=record)<EOL><DEDENT>inclusion_request_created.send(<EOL>current_app._get_current_object(),<EOL>request=obj,<EOL>notify=notify<EOL>)<EOL>return obj<EOL>
Create a record inclusion request to a community.

        :param community: Community object.
        :param record: Record API object.
        :param expires_at: Time after which the request expires and shouldn't
            be resolved anymore.