@classmethod
def _reshape(cls, dsShape, rank, extends, extraD, exDim):
    """ recalculates shape

        :param dsShape: origin shape of the object
        :type dsShape: :obj:`list` <:obj:`int` >
        :param rank: rank of the object
        :type rank: : obj:`str` or obj:`int`
        :param extends: If True extends the shape up to rank value
        :type extends: :obj:`bool`
        :param exDim: grows growing dimension + 1
        :type exDim: :obj:`int`
        :param extraD: True if the object grows
        :type extraD: :obj:`bool`
        :returns: shape of the  h5 field
        :rtype: :obj:`list` <:obj:`int` >

        """
    shape = []
    if dsShape:
        for s in dsShape:
            if s and extends:
                shape.append(s)
            elif not extends and s and s > 0:
                shape.append(s)
        while extends and len(shape) < int(rank):
            shape.append(0)
        if extraD:
            shape.insert(exDim - 1, 0)
    return shape
