#TODO: docstring

    Note: Expects sorted arrays.

    :param dependentVar: #TODO: docstring
    :param independentVar: #TODO: docstring
    :param subsetPercentage: #TODO: docstring
    :param cycles: #TODO: docstring
    :param minKnotPoints: #TODO: docstring
    :param initialKnots: #TODO: docstring
    :param splineOrder: #TODO: docstring
    :param terminalExpansion: expand subsets on both sides

    :returns: #TODO: docstring

def returnSplineList(dependentVar, independentVar, subsetPercentage=0.4,
                     cycles=10, minKnotPoints=10, initialKnots=200,
                     splineOrder=2, terminalExpansion=0.1
                     ):
    """ #TODO: docstring

    Note: Expects sorted arrays.

    :param dependentVar: #TODO: docstring
    :param independentVar: #TODO: docstring
    :param subsetPercentage: #TODO: docstring
    :param cycles: #TODO: docstring
    :param minKnotPoints: #TODO: docstring
    :param initialKnots: #TODO: docstring
    :param splineOrder: #TODO: docstring
    :param terminalExpansion: expand subsets on both sides

    :returns: #TODO: docstring
    """
    expansions = ddict(list)
    expansionArea = (independentVar[-1] - independentVar[0]) * terminalExpansion
    #adds 100 data points at both ends of the dependent and independent array
    for i in range(100):
        expansions['indUp'].append(independentVar[-1] + expansionArea/100*i)
        expansions['indDown'].append(independentVar[0] -
                                     expansionArea/100*(100-i+1)
                                     )
        expansions['depUp'].append(dependentVar[-1])
        expansions['depDown'].append(dependentVar[0])

    dependentVar = numpy.array(expansions['depDown'] + list(dependentVar) +
                               expansions['depUp'], dtype=numpy.float64
                               )
    independentVar = numpy.array(expansions['indDown'] + list(independentVar) +
                                 expansions['indUp'], dtype=numpy.float64
                                 )

    splineList = list()
    for cycle in range(cycles):
        subset = sorted(random.sample(range(len(dependentVar)),
                                      int(len(dependentVar) * subsetPercentage)
                                      )
                        )
        terminalExpansion

        dependentSubset = dependentVar[subset]
        independentSubset = independentVar[subset]

        minIndVar = independentSubset[minKnotPoints]
        maxIndVar = independentSubset[-minKnotPoints]

        knots = [float(i) * (maxIndVar-minIndVar) / initialKnots + minIndVar
                 for i in range(1, initialKnots)
                 ]
        ## remove knots with less then minKnotPoints data points  ##
        lastKnot = knots[0]
        newKnotList = [lastKnot]
        for knotPos in range(1,len(knots)):
            nextKnot = knots[knotPos]
            numHits = (len(independentSubset[(independentSubset >= lastKnot) &
                       (independentSubset <= nextKnot)])
                       )
            if numHits >= minKnotPoints:
                newKnotList.append(nextKnot)
                lastKnot = nextKnot
        knots = newKnotList

        spline = LSQUnivariateSpline(independentSubset, dependentSubset, knots,
                                     k=splineOrder)
        splineList.append(spline)
    return splineList