#  Copyright (c) PARRRATE T&V 2021. All rights reserved.

from bu4.evaluation.constructs.evaluable import Evaluable
from bu4.evaluation.constructs.evalue import EValue

__all__ = ('sync',)


def sync(evaluable: Evaluable) -> EValue:
    while True:
        if isinstance(evaluable, EValue):
            return evaluable
        evaluable = evaluable.next()