def METHOD_NAME(stack, marker):
    """
    Checks if markers do not cross.
    You can pop from stack only if end
    marker match previous one.
    Example OK:
        MACRO1.BEGIN
            MACRO2.BEGIN
            MACRO2.END
        MACRO1.END
    Example NOT OK:
        MACRO1.BEGIN
            MACRO2.BEGIN
        MACRO1.END
            MACRO2.END
    """
    top = stack[-1][0]
    if top.endswith(OperationFactory.__suffix[0]):
        top = top[: -len(OperationFactory.__suffix[0])]
    if marker.endswith(OperationFactory.__suffix[-1]):
        marker = marker[: -len(OperationFactory.__suffix[-1])]
    if top != marker:
        raise NotSupportedOperationException(
            "Cannot cross markers: {0}, {1}".format(top, marker)
        )