<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def averageValues(self):
 """ return the averaged values in the grid """

        assert self.opts['record_density'] and self.opts['method'] == 'sum'
        # dont increase value of partly filled cells (density 0..1):
        filled = self.density > 1
        v = self.values.copy()
        v[filled] /= self.density[filled]

        # ONLY AS OPTION??:
        v[~filled] *= self.density[~filled]
        return v