def METHOD_NAME(shape_a: Tuple[int, ...], shape_b: Tuple[int, ...]) -> Tuple[int, ...]:
    """
    Infers, if possible, the broadcast output shape of two operands a and b. Inspired by stackoverflow post:
    https://stackoverflow.com/questions/24743753/test-if-an-array-is-broadcastable-to-a-shape
    Parameters
    ----------
    shape_a : Tuple[int,...]
        Shape of first operand
    shape_b : Tuple[int,...]
        Shape of second operand
    Raises
    -------
    ValueError
        If the two shapes cannot be broadcast.
    Examples
    --------
    >>> import heat as ht
    >>> ht.core.stride_tricks.broadcast_shape((5,4),(4,))
    (5, 4)
    >>> ht.core.stride_tricks.broadcast_shape((1,100,1),(10,1,5))
    (10, 100, 5)
    >>> ht.core.stride_tricks.broadcast_shape((8,1,6,1),(7,1,5,))
    (8,7,6,5))
    >>> ht.core.stride_tricks.broadcast_shape((2,1),(8,4,3))
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "heat/core/stride_tricks.py", line 42, in broadcast_shape
        "operands could not be broadcast, input shapes {} {}".format(shape_a, shape_b)
    ValueError: operands could not be broadcast, input shapes (2, 1) (8, 4, 3)
    """
    try:
        resulting_shape = torch.broadcast_shapes(shape_a, shape_b)
    except AttributeError:  # torch < 1.8
        it = itertools.zip_longest(shape_a[::-1], shape_b[::-1], fillvalue=1)
        resulting_shape = max(len(shape_a), len(shape_b)) * [None]
        for i, (a, b) in enumerate(it):
            if a == 0 and b == 1 or b == 0 and a == 1:
                resulting_shape[i] = 0
            elif a == 1 or b == 1 or a == b:
                resulting_shape[i] = max(a, b)
            else:
                raise ValueError(
                    f"operands could not be broadcast, input shapes {shape_a} {shape_b}"
                )
        return tuple(resulting_shape[::-1])
    except TypeError:
        raise TypeError(f"operand 1 must be tuple of ints, not {type(shape_a)}")
    except NameError:
        raise TypeError(f"operands must be tuples of ints, not {shape_a} and {shape_b}")
    except RuntimeError:
        raise ValueError(f"operands could not be broadcast, input shapes {shape_a} {shape_b}")
    return tuple(resulting_shape)