def _check_can_broadcast_to(shape, target_shape):
    """Determines if shape can be broadcast to target_shape."""
    ndim = len(shape)
    ndim_target = len(target_shape)
    if ndim > ndim_target:
        return False
    for i, j in zip(reversed(shape), reversed(target_shape)):
        if i not in (1, j):
            return False
    return True