<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def plugins(self, deduplicate=False):
        '''
            Returns a flattened list of all plugins used by page components.
        '''
        plugins = []
        for c in self.components:
            if hasattr(c, 'plugins'):
                plugins += c.plugins()
            elif isinstance(c, Lib):
                plugins.append(c)
            elif hasattr(c, 'is_plugin') and c.is_plugin:
                plugins.append(c)

        if deduplicate:
            plugins = list(OrderedDict.fromkeys(plugins))
        return plugins