def _shape_equal(shape1, shape2):
    """
    Check if shape of stream are compatible.
    More or less shape1==shape2 but deal with:
      * shape can be list or tuple
      * shape can have one dim with -1
    """
    shape1 = list(shape1)
    shape2 = list(shape2)
    if len(shape1) != len(shape2):
        return False
    
    for i in range(len(shape1)):
        if shape1[i]==-1 or shape2[i]==-1:
            continue
        if shape1[i]!=shape2[i]:
            return False
    
    return True