<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def component_by_key(self, key):
 """Retrieve component by its key. :param key: Component key :type key: str :return: ReportComponentsMetadata :rtype: ReportComponentsMetadata .. versionadded:: 4.0 """

        filtered = [c for c in self.components if c.key == key]
        if filtered:
            return filtered[0]
        return None