<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def pattern(self, platform, key, compiled=True):
 """Return the pattern defined by the key string specific to the platform. :param platform: :param key: :param compiled: :return: Pattern string or RE object. """

        patterns = self._platform_patterns(platform, compiled=compiled)
        pattern = patterns.get(key, self._platform_patterns(compiled=compiled).get(key, None))

        if pattern is None:
            raise KeyError("Patterns database corrupted. Platform: {}, Key: {}".format(platform, key))

        return pattern