<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def parse_quality(self):
 """Check quality paramater. Sets self.quality_val based on simple substitution of 'native' for default. Checks for the three valid values else throws an IIIFRequestError. """

        if (self.quality is None):
            self.quality_val = self.default_quality
        elif (self.quality not in self.allowed_qualities):
            raise IIIFRequestError(
                code=400, parameter="quality",
                text="The quality parameter must be '%s', got '%s'." %
                ("', '".join(self.allowed_qualities), self.quality))
        else:
            self.quality_val = self.quality