def restart_worker(uuid, **kwargs):
    """Restart workflow from beginning with given engine UUID and any data.

    ``**kwargs`` can be used to pass custom arguments to the engine/object such
    as ``data``. If ``data`` is not specified then it will load all
    initial data for the data objects.

    Data can be specified as list of objects or single id of
    WorkflowObjects.

    :param uuid: workflow id (uuid) of the ``WorkflowEngine`` to be restarted
    :type uuid: str

    :return: ``WorkflowEngine`` instance
    """
    if 'stop_on_halt' not in kwargs:
        kwargs['stop_on_halt'] = False

    engine = WorkflowEngine.from_uuid(uuid=uuid, **kwargs)

    if "data" not in kwargs:
        objects = workflow_object_class.query(id_workflow=uuid)
    else:
        data = kwargs.pop("data")
        if not isinstance(data, (list, tuple)):
            data = [data]
        objects = get_workflow_object_instances(data, engine)

    db.session.commit()
    engine.process(objects, **kwargs)
    return engine
Restart workflow from beginning with given engine UUID and any data.

    ``**kwargs`` can be used to pass custom arguments to the engine/object such
    as ``data``. If ``data`` is not specified then it will load all
    initial data for the data objects.

    Data can be specified as list of objects or single id of
    WorkflowObjects.

    :param uuid: workflow id (uuid) of the ``WorkflowEngine`` to be restarted
    :type uuid: str

    :return: ``WorkflowEngine`` instance