<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def sample_within_cc(self, cc_index, nsamples=1):
 """ Returns randomly sampled points from a polygon. Complexity of this procedure is (A/a * nsamples) where A=area(bbox(P)) and a=area(P) where P is the polygon of the connected component cc_index """

        polygon = self.geometries[cc_index]['polygon']
        samples = []
        while len(samples) < nsamples:
            point = PointSampler.random_point(polygon.envelope.bounds)
            if PointSampler.contains(polygon, point):
                samples.append(point)
        return samples