def _get_shape(array_like):
    """Return shape of an array like object.

    In case the object is a nested sequence (list of lists, tuples...),
    the size of each dimension is assumed to be uniform, and is deduced from
    the length of the first sequence.

    :param array_like: Array like object: numpy array, hdf5 dataset,
        multi-dimensional sequence
    :return: Shape of array, as a tuple of integers
    """
    if hasattr(array_like, 'shape'):
        return array_like.shape
    shape = []
    subsequence = array_like
    while hasattr(subsequence, '__len__'):
        shape.append(len(subsequence))
        subsequence = subsequence[0]
    return tuple(shape)
