docs: def create_entity(self):
          """Create entity if `flow_collection` is defined in process.
  
          Following rules applies for adding `Data` object to `Entity`:
          * Only add `Data object` to `Entity` if process has defined
          `flow_collection` field
          * Add object to existing `Entity`, if all parents that are part
          of it (but not necessary all parents), are part of the same
          `Entity`
          * If parents belong to different `Entities` or do not belong to
          any `Entity`, create new `Entity`
  
          """
          entity_type = self.process.entity_type  # pylint: disable=no-member
          entity_descriptor_schema = self.process.entity_descriptor_schema  # pylint: disable=no-member
          entity_input = self.process.entity_input  # pylint: disable=no-member
  
          if entity_type:
              data_filter = {}
              if entity_input:
                  input_id = dict_dot(self.input, entity_input, default=lambda: None)
                  if input_id is None:
                      logger.warning("Skipping creation of entity due to missing input.")
                      return
                  if isinstance(input_id, int):
                      data_filter['data__pk'] = input_id
                  elif isinstance(input_id, list):
                      data_filter['data__pk__in'] = input_id
                  else:
                      raise ValueError(
                          "Cannot create entity due to invalid value of field {}.".format(entity_input)
                      )
              else:
                  data_filter['data__in'] = self.parents.all()  # pylint: disable=no-member
  
              entity_query = Entity.objects.filter(type=entity_type, **data_filter).distinct()
              entity_count = entity_query.count()
  
              if entity_count == 0:
                  descriptor_schema = DescriptorSchema.objects.filter(
                      slug=entity_descriptor_schema
                  ).latest()
                  entity = Entity.objects.create(
                      contributor=self.contributor,
                      descriptor_schema=descriptor_schema,
                      type=entity_type,
                      name=self.name,
                      tags=self.tags,
                  )
                  assign_contributor_permissions(entity)
  
              elif entity_count == 1:
                  entity = entity_query.first()
                  copy_permissions(entity, self)
  
              else:
                  logger.info("Skipping creation of entity due to multiple entities found.")
                  entity = None
  
              if entity:
                  entity.data.add(self)
                  # Inherit collections from entity.
                  for collection in entity.collections.all():
                      collection.data.add(self)