<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def average(self, projection=None):
 """ Takes the average of elements in the sequence 1.5 :param projection: function to project on the sequence before taking the average :return: average of elements in the sequence """

        length = self.size()
        if projection:
            return sum(self.map(projection)) / length
        else:
            return sum(self) / length