<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def by_value(self, value, default=None):
 """ Returns the key for the given value """

        try:
            return [k for k, v in self.items() if v == value][0]
        except IndexError:
            if default is not None:
                return default
            raise ValueError('%s' % value)