<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def extract_subset(self, subset, contract=True):
 """ Return all nodes in a subset. We assume the oboInOwl encoding of subsets, and subset IDs are IRIs, or IR fragments """

        return [n for n in self.nodes() if subset in self.subsets(n, contract=contract)]