def _get_example_shape(example):
    """Gets the shape of an object if applicable."""
    shape = []
    if hasattr(example, "__len__"):
        length = len(example)
        shape = [length]
        if length > 0:
            shape += _get_example_shape(example[0])
    return shape