Analyze data and create corresponding WorkflowObjects.

    Wrap each item in the given list of data objects into WorkflowObject
    instances - creating appropriate status of objects in the database and
    returning a list of these objects.

    This process is necessary to save an initial status of the data before
    running it (and potentially changing it) in the workflow.

    This function also takes into account if given data objects are already
    WorkflowObject instances.

    :param data: list of data objects to wrap
    :type data: list

    :param engine: instance of WorkflowEngine
    :type engine: py:class:`.engine.WorkflowEngine`

    :return: list of WorkflowObject

def get_workflow_object_instances(data, engine):
    """Analyze data and create corresponding WorkflowObjects.

    Wrap each item in the given list of data objects into WorkflowObject
    instances - creating appropriate status of objects in the database and
    returning a list of these objects.

    This process is necessary to save an initial status of the data before
    running it (and potentially changing it) in the workflow.

    This function also takes into account if given data objects are already
    WorkflowObject instances.

    :param data: list of data objects to wrap
    :type data: list

    :param engine: instance of WorkflowEngine
    :type engine: py:class:`.engine.WorkflowEngine`

    :return: list of WorkflowObject
    """
    workflow_objects = []
    data_type = engine.get_default_data_type()

    for data_object in data:
        if isinstance(
            data_object, workflow_object_class._get_current_object()
        ):
            if not data_object.data_type:
                data_object.data_type = data_type

            if data_object.id:
                data_object.log.debug("Existing workflow object found for "
                                      "this object.")
                if data_object.status == data_object.known_statuses.COMPLETED:
                    data_object.status = data_object.known_statuses.INITIAL

            workflow_objects.append(data_object)
        else:
            # Data is not already a WorkflowObject, we then
            # add the running object to run through the workflow.
            current_obj = create_data_object_from_data(
                data_object,
                engine,
                data_type
            )
            workflow_objects.append(current_obj)

    return workflow_objects