INPUT PARAMETERS: 
        M: HITRAN molecule number              (required)
        I: HITRAN isotopologue number          (required)
        T: temperature conditions              (required)
        step:  step to calculate temperatures  (optional)
    OUTPUT PARAMETERS:
        TT: list of temperatures (present only if T is a list)
        PartSum: partition sums calculated on a list of temperatures
    ---
    DESCRIPTION:
        Calculate range of partition sums at different temperatures.
        This function uses a python implementation of TIPS-2011 code:

        Reference:
            A. L. Laraia, R. R. Gamache, J. Lamouroux, I. E. Gordon, L. S. Rothman.
            Total internal partition sums to support planetary remote sensing.
            Icarus, Volume 215, Issue 1, September 2011, Pages 391–400
            http://dx.doi.org/10.1016/j.icarus.2011.06.004

        Output depends on a structure of input parameter T so that:
            1) If T is a scalar/list and step IS NOT provided,
                then calculate partition sums over each value of T.
            2) If T is a list and step parameter IS provided,
                then calculate partition sums between T[0] and T[1]
                with a given step.
    ---
    EXAMPLE OF USAGE:
        PartSum = partitionSum(1,1,[296,1000])
        TT,PartSum = partitionSum(1,1,[296,1000],step=0.1)
    ---

def partitionSum(M,I,T,step=None):
    """
    INPUT PARAMETERS: 
        M: HITRAN molecule number              (required)
        I: HITRAN isotopologue number          (required)
        T: temperature conditions              (required)
        step:  step to calculate temperatures  (optional)
    OUTPUT PARAMETERS:
        TT: list of temperatures (present only if T is a list)
        PartSum: partition sums calculated on a list of temperatures
    ---
    DESCRIPTION:
        Calculate range of partition sums at different temperatures.
        This function uses a python implementation of TIPS-2011 code:

        Reference:
            A. L. Laraia, R. R. Gamache, J. Lamouroux, I. E. Gordon, L. S. Rothman.
            Total internal partition sums to support planetary remote sensing.
            Icarus, Volume 215, Issue 1, September 2011, Pages 391–400
            http://dx.doi.org/10.1016/j.icarus.2011.06.004

        Output depends on a structure of input parameter T so that:
            1) If T is a scalar/list and step IS NOT provided,
                then calculate partition sums over each value of T.
            2) If T is a list and step parameter IS provided,
                then calculate partition sums between T[0] and T[1]
                with a given step.
    ---
    EXAMPLE OF USAGE:
        PartSum = partitionSum(1,1,[296,1000])
        TT,PartSum = partitionSum(1,1,[296,1000],step=0.1)
    ---
    """
    # partitionSum
    if not step:
       if type(T) not in set([list,tuple]):
          return BD_TIPS_2011_PYTHON(M,I,T)[1]
       else:
          return [BD_TIPS_2011_PYTHON(M,I,temp)[1] for temp in T]
    else:
       #n = (T[1]-T[0])/step
       #TT = linspace(T[0],T[1],n)
       TT = arange(T[0],T[1],step)
       return TT,array([BD_TIPS_2011_PYTHON(M,I,temp)[1] for temp in TT])