def METHOD_NAME(root: OP_TREE) -> Iterator[Union[Operation, 'cirq.Moment']]:
    """Performs an in-order iteration OP_TREE, yielding ops and moments.
    Args:
        root: The operation or tree of operations to iterate.
    Yields:
        Operations or moments from the tree.
    Raises:
        TypeError: root isn't a valid OP_TREE.
    """
    if isinstance(root, (Operation, moment.Moment)):
        yield root
    elif isinstance(root, Iterable) and not isinstance(root, str):
        for subtree in root:
            yield from METHOD_NAME(subtree)
    else:
        _bad_op_tree(root)