Well, there's a built-in method for this in the RandomForestClassifier. It is called forest.predict_proba(X). Random forest classifier creates a set of decision trees from a randomly selected subset of the training set. It then aggregates the votes from different decision trees to decide the final class of the test object.
I hope this helps.