def METHOD_NAME(L,M,timesL, timesM,root,scale,s_species, maxSP,gl=0,gm=0,Dtraj=[0],Tcomp_clade=[0]):
	ts=list()
	te=list()
	l_t=L[0]
	m_t=M[0]
	L,M,root=L/scale,M/scale,int(root*scale)
	for i  in range(s_species): 
		ts.append(root)
		te.append(0)
	for t in range(root,0): # time
		if gl==0 and gm==0:
			for j in range(len(timesL)-1):
				if -t/scale<=timesL[j] and -t/scale>timesL[j+1]: l=L[j]
			for j in range(len(timesM)-1):
				if -t/scale<=timesM[j] and -t/scale>timesM[j+1]: m=M[j]
		elif max(Dtraj)>0:
			try: D=Dtraj[Tcomp_clade== -int(t/scale)][0]
			except(IndexError): D=0 # if curves do not overlap, no competition
			te_temp = np.array(te)
			D_l=len(te_temp[te_temp==0])
			l = trans_rate_linear(l_t,gl,D)
			#l = trans_rate_linear(l,-0.05,D_l)
			m = trans_rate_linear(m_t,gm,D)
			l,m = l/scale, m/scale
			#if t%100==0: t*scale, D, l*scale, m*scale,gl,gm
		else:
			te_temp = np.array(te)
			D=len(te_temp[te_temp==0])
			l = trans_rate_linear(l_t,gl,D)
			m = trans_rate_linear(m_t,gm,D)
			#if t%100==0: print l_t,l,m,D,gl
			l,m = l/scale, m/scale			
		#if t % 100 ==0: print t/scale, -times[j], -times[j+1], l, m
		TE=len(te)
		if TE>maxSP: 
			break
		for j in range(TE): # extant lineages
			if te[j]==0:
				ran=random.random()
				if ran<l: 
					te.append(0) # add species
					ts.append(t) # sp time
				elif ran>l and ran < (l+m): # extinction
					te[j]=t
	te=array(te)
	return -array(ts)/scale, -(te)/scale