<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def stratify(self):
 		""" 		Stratifies the sample based on propensity score. 		 		By default the sample is divided into five equal-sized bins. 		The number of bins can be set by modifying the object 		attribute named blocks. Alternatively, custom-sized bins can 		be created by setting blocks equal to a sorted list of numbers 		between 0 and 1 indicating the bin boundaries. 		This method should only be executed after the propensity score 		has been estimated. 		"""


		Y, D, X = self.raw_data['Y'], self.raw_data['D'], self.raw_data['X']
		pscore = self.raw_data['pscore']

		if isinstance(self.blocks, int):
			blocks = split_equal_bins(pscore, self.blocks)
		else:
			blocks = self.blocks[:]  # make a copy; should be sorted
			blocks[0] = 0  # avoids always dropping 1st unit

		def subset(p_low, p_high):
			return (p_low < pscore) & (pscore <= p_high)
		subsets = [subset(*ps) for ps in zip(blocks, blocks[1:])]
		strata = [CausalModel(Y[s], D[s], X[s]) for s in subsets]
		self.strata = Strata(strata, subsets, pscore)