def shapes_equal(a, b):
    """
    Tests if two nested lists are of the same shape

    :param a: list

    :param b: list

    :returns: True if lists are indeed of the same shape, False otherwise
    """
    if len(a) != len(b):
        return False
    if any(isinstance(x, list) and isinstance(y, list) and len(x) != len(y)
           for x, y in zip(a, b)):
        return False
    return True