def create_document(self, identifier, text, metadata=None, update_mode=False):
        if metadata is None:
            metadata = {}

        filter_query = IEDocument.objects.filter(human_identifier=identifier)
        if not filter_query.exists():
            mtd_obj = IEDocumentMetadata.objects.create(items=metadata)
            doc = IEDocument.objects.create(human_identifier=identifier, text=text,
                                            metadata=mtd_obj)
        else:
            doc = filter_query.get()
        if update_mode:
            doc.text = text
            doc.metadata.items = metadata
            doc.metadata.save()
            doc.save()

        return doc
Returns an IPv4Address.
dataset/ETHPy150Open machinalis/iepy/iepy/data/db.py/DocumentManager.create_document--crossover with--dataset/ETHPy150Open twisted/twisted/twisted/internet/iocpreactor/tcp.py/Server.getPeer